Package gnu.trove.set

Examples of gnu.trove.set.TIntSet.addAll()



    public void testToArray() {
        TIntSet set = new TIntHashSet();
        int[] ints = {42, 1138, 13, 86, 99};
        set.addAll(ints);
        int[] res = set.toArray();
        Arrays.sort(ints);
        Arrays.sort(res);
        assertTrue(Arrays.equals(ints, res));
    }
View Full Code Here


  // Test for issue #34 (https://bitbucket.org/robeden/trove/issue/34)
  public void testToArraySmallerInput() {
        TIntSet set = new TIntHashSet();
        int[] ints = {42, 1138, 13, 86, 99};
        set.addAll(ints);


    int[] input = new int[ 3 ];
    int[] result = set.toArray( input );
View Full Code Here


    public void testToArrayMatchesIteratorOrder() {
        TIntSet set = new TIntHashSet();
        int[] ints = {42, 1138, 13, 86, 99};
        set.addAll(ints);
        int[] toarray_ints = set.toArray();

        int[] iter_ints = new int[5];
        TIntIterator iter = set.iterator();
View Full Code Here

        int no_entry_value = Integer.MIN_VALUE;
        TIntSet set = new TIntHashSet(10, 0.5f, no_entry_value);
        assertEquals(no_entry_value, set.getNoEntryValue());

        int[] ints = {42, 1138, 13, 86, 99};
        set.addAll(ints);

        int[] sink = new int[ints.length + 2];
        sink[sink.length - 1] = -1;
        sink[sink.length - 2] = -2;
View Full Code Here


    public void testForEach() {
        TIntSet set = new TIntHashSet(10, 0.5f);
        int[] ints = {1138, 42, 86, 99, 101};
        set.addAll(ints);

        class ForEach implements TIntProcedure {

            TIntSet built = new TIntHashSet();
View Full Code Here


    public void testEquals() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll(ints);
        TIntSet other = new TIntHashSet();
        other.addAll(ints);

        assertTrue("sets incorrectly not equal: " + set + ", " + other,
                set.equals(other));
View Full Code Here

    public void testEquals() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll(ints);
        TIntSet other = new TIntHashSet();
        other.addAll(ints);

        assertTrue("sets incorrectly not equal: " + set + ", " + other,
                set.equals(other));

        int[] mismatched = {72, 49, 53, 1024, 999};
View Full Code Here

        assertTrue("sets incorrectly not equal: " + set + ", " + other,
                set.equals(other));

        int[] mismatched = {72, 49, 53, 1024, 999};
        TIntSet unequal = new TIntHashSet();
        unequal.addAll(mismatched);

        assertFalse("sets incorrectly equal: " + set + ", " + unequal,
                set.equals(unequal));

        // Change length, different code branch
View Full Code Here


    public void testHashcode() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll(ints);
        TIntSet other = new TIntHashSet();
        other.addAll(ints);

        assertTrue("hashcodes incorrectly not equal: " + set + ", " + other,
                set.hashCode() == other.hashCode());
View Full Code Here

    public void testHashcode() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll(ints);
        TIntSet other = new TIntHashSet();
        other.addAll(ints);

        assertTrue("hashcodes incorrectly not equal: " + set + ", " + other,
                set.hashCode() == other.hashCode());

        int[] mismatched = {72, 49, 53, 1024, 999};
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.