Sets.newHashSet(E... elements) has a slightly altered implementation

in guava 10, such that it creates the Set with a different initial size
than it used to, which causes the resulting Set to have a different
iteration order than in the passt.

By constructing from an ImmutableSet (with a defined iteration order)
the HashSet behaves as it used to.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6710 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2011-09-28 23:18:20 +00:00
parent 0c42de73b3
commit ba1ccd19ef
@@ -39,6 +39,7 @@ import static org.junit.Assert.*;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -143,9 +144,9 @@ public class StreamableTest
public Collection<Integer> collection = Arrays.asList(4, 5, 6);
public Collection<Integer> nullCollection = null;
public Set<Integer> set = Sets.newHashSet(6, 7, 8);
public Set<Integer> set = Sets.newHashSet(ImmutableSet.of(6, 7, 8));
public Set<Integer> nullSet = null;
public HashSet<Integer> hashSet = Sets.newHashSet(7, 8, 9);
public HashSet<Integer> hashSet = Sets.newHashSet(ImmutableSet.of(7, 8, 9));
public HashSet<Integer> nullHashSet = null;
public Map<Integer, String> map = ImmutableMap.of(1, "one", 2, "two", 3, "three");