Package com.gs.collections.impl.list.mutable.primitive

Examples of com.gs.collections.impl.list.mutable.primitive.ShortArrayList


    public ShortList peek(int count)
    {
        this.checkNegativeCount(count);
        if (count == 0)
        {
            return new ShortArrayList(0);
        }
        if (count == 1)
        {
            return ShortArrayList.newListWith(this.element1);
        }
View Full Code Here


        return true;
    }

    public ImmutableShortList select(ShortPredicate predicate)
    {
        ShortArrayList result = new ShortArrayList();
        for (short item : this.items)
        {
            if (predicate.accept(item))
            {
                result.add(item);
            }
        }
        return result.toImmutable();
    }
View Full Code Here

        return result.toImmutable();
    }

    public ImmutableShortList reject(ShortPredicate predicate)
    {
        ShortArrayList result = new ShortArrayList();
        for (short item : this.items)
        {
            if (!predicate.accept(item))
            {
                result.add(item);
            }
        }
        return result.toImmutable();
    }
View Full Code Here

    private final ShortArrayList delegate;

    private ImmutableShortArrayStack(short[] newElements)
    {
        this.checkOptimizedSize(newElements.length);
        this.delegate = new ShortArrayList(newElements);
    }
View Full Code Here

        return new ImmutableShortArrayStack(ShortArrayList.newList(items).reverseThis());
    }

    public ImmutableShortStack push(short item)
    {
        ShortArrayList newDelegate = ShortArrayList.newList(this.delegate);
        newDelegate.add(item);
        return new ImmutableShortArrayStack(newDelegate);
    }
View Full Code Here

        return new ImmutableShortArrayStack(newDelegate);
    }

    public ImmutableShortStack pop()
    {
        ShortArrayList newDelegate = ShortArrayList.newList(this.delegate);
        newDelegate.removeAtIndex(this.delegate.size() - 1);
        return ShortStacks.immutable.with(newDelegate.toArray());
    }
View Full Code Here

        if (count == 0)
        {
            return this;
        }
        this.checkSizeLessThanCount(count);
        ShortArrayList newDelegate = ShortArrayList.newList(this.delegate);
        while (count > 0)
        {
            newDelegate.removeAtIndex(newDelegate.size() - 1);
            count--;
        }
        return ShortStacks.immutable.with(newDelegate.toArray());
    }
View Full Code Here

    {
        this.checkNegativeCount(count);
        this.checkSizeLessThanCount(count);
        if (count == 0)
        {
            return new ShortArrayList();
        }
        MutableShortList subList = new ShortArrayList(count);
        int index = this.delegate.size() - 1;
        for (int i = 0; i < count; i++)
        {
            subList.add(this.delegate.get(index - i));
        }
        return subList;
    }
View Full Code Here

        }

        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
        {
            int size = in.readInt();
            ShortArrayList deserializedDelegate = new ShortArrayList(size);

            for (int i = 0; i < size; i++)
            {
                deserializedDelegate.add(in.readShort());
            }

            this.stack = ImmutableShortArrayStack.newStackFromTopToBottom(deserializedDelegate);
        }
View Full Code Here

        return !predicate.accept(this.value1);
    }

    public ImmutableShortCollection select(ShortPredicate predicate)
    {
        return predicate.accept(this.value1) ? ShortArrayList.newListWith(this.value1).toImmutable() : new ShortArrayList().toImmutable();
    }
View Full Code Here

TOP

Related Classes of com.gs.collections.impl.list.mutable.primitive.ShortArrayList

Copyright © 2018 www.massapicom. 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.