Skip to content

Commit 08acb34

Browse files
committed
Edit Zoo.java
1 parent c720c55 commit 08acb34

File tree

1 file changed

+8
-0
lines changed
  • JunitAndGenericsTaskTree/src/Junit_Less_8/main/java/GenericClasses

1 file changed

+8
-0
lines changed

JunitAndGenericsTaskTree/src/Junit_Less_8/main/java/GenericClasses/Zoo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ public static <U extends Cat> void transfer(Zoo<? extends U> source, Zoo<? super
6161
*/
6262
source.cats.clear();
6363
}
64+
/*
65+
Пример статического метода параметризированного <T> и возвращающего
66+
T, отсюда такая последовательность <Т> Т. В метод передается коллекция
67+
также параметризированная T.
68+
*/
69+
public static <T> T getFirstElementFromCollections(List<T> list){
70+
return list.get(0);
71+
}
6472

6573
public List<T> getCats() {
6674
return cats;

0 commit comments

Comments
 (0)