Set implementations where the order of the elements in the Set is a partial order:Set where some elements in the Set are ordered explictlySet where some elements in the Set are ordered explictly. The other elements are ordered by their natural orderPartiallyOrderedHashSet and PartiallyOrderedTreeSet classes implement the PartiallyOrderedSet interface.
second object must be iterated after the first objectPartiallyOrderedHashSet<String> set = new PartiallyOrderedHashSet<>(); set.add("A"); set.add("B"); set.add("C"); set.add("D"); set.setOrdering("D", "B"); set.setOrdering("C", "A"); set.setOrdering("A", "D"); Iterator<String> it = set.iterator(); String elt = it.next(); // elt is "C" elt = it.next(); // elt is "A" elt = it.next(); // elt is "D" elt = it.next(); // elt is "B"
Copyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences
Project Web Hosted by
Copyright 1999-2010 -
Geeknet, Inc., All Rights Reserved
About
-
Legal
-
Help