Search in sources :

Example 1 with Equivalence

use of org.graalvm.collections.Equivalence in project graal by oracle.

the class EconomicMapImplTest method testNewEquivalence.

@Test
public void testNewEquivalence() {
    EconomicSet<Integer> set = EconomicSet.create(new Equivalence() {

        @Override
        public boolean equals(Object a, Object b) {
            return false;
        }

        @Override
        public int hashCode(Object o) {
            return 0;
        }
    });
    set.addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
    Assert.assertTrue(set.add(new Integer(0)));
}
Also used : Equivalence(org.graalvm.collections.Equivalence) Test(org.junit.Test)

Aggregations

Equivalence (org.graalvm.collections.Equivalence)1 Test (org.junit.Test)1