OnJava8-Examples/containersindepth/IndividualTest.java

22 lines
590 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// containersindepth/IndividualTest.java
2015-06-15 17:47:35 -07:00
import containers.MapOfList;
import typeinfo.pets.*;
import java.util.*;
public class IndividualTest {
public static void main(String[] args) {
Set<Individual> pets = new TreeSet<>();
for(List<? extends Pet> lp :
MapOfList.petPeople.values())
for(Pet p : lp)
pets.add(p);
System.out.println(pets);
}
2015-09-07 11:44:36 -06:00
}
/* Output:
2015-06-15 17:47:35 -07:00
[Cat Elsie May, Cat Pinkola, Cat Shackleton, Cat Stanford
aka Stinky el Negro, Cymric Molly, Dog Margrett, Mutt Spot,
Pug Louie aka Louis Snorkelstein Dupree, Rat Fizzy, Rat
Freckly, Rat Fuzzy]
2015-09-07 11:44:36 -06:00
*/