Interface FixedSizeCollection<T>

    • Method Detail

      • with

        MutableCollection<T> with​(T element)
        This method allows fixed size collections the ability to add elements to their existing elements. A new instance of MutableCollection is returned containing the elements of the original collection with the new element added. Implementations will return a new FixedSizeCollection where possible. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
         MutableCollection<String> list;
         list = list.with("1");
         list = list.with("2");
         return list;
         
        Specified by:
        with in interface MutableCollection<T>
        See Also:
        add(Object)
      • without

        MutableCollection<T> without​(T element)
        This method allows fixed size collections the ability to remove elements from their existing elements. A new instance of MutableCollection is returned containing the elements of the original collection with the element removed. Implementations will return a new FixedSizeCollection where possible. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
         MutableCollection<String> list;
         list = list.without("1");
         list = list.without("2");
         return list;
         
        Specified by:
        without in interface MutableCollection<T>
        See Also:
        remove(Object)
      • withAll

        MutableCollection<T> withAll​(java.lang.Iterable<? extends T> elements)
        This method allows fixed size collections the ability to add multiple elements to their existing elements. A new instance of MutableCollection is returned containing the elements of the original collection with all the new elements addAll(Collection) added. Implementations will return a new FixedSizeCollection where possible. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
         MutableCollection<String> list;
         list = list.withAll(FastList.newListWith("1", "2"));
         return list;
         
        Specified by:
        withAll in interface MutableCollection<T>
        See Also:
        addAll(Collection)
      • withoutAll

        MutableCollection<T> withoutAll​(java.lang.Iterable<? extends T> elements)
        This method allows fixed size collections the ability to remove multiple elements from their existing elements. A new instance of MutableCollection is returned containing the elements of the original collection with the given elements removed. Implementations will return a new FixedSizeCollection where possible. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
         MutableCollection<String> list;
         list = list.withoutAll(FastList.newListWith("1", "2"));
         return list;
         
        Specified by:
        withoutAll in interface MutableCollection<T>
        See Also:
        removeAll(Collection)
      • add

        boolean add​(T t)
        Specified by:
        add in interface java.util.Collection<T>
        Throws:
        java.lang.UnsupportedOperationException - the add operation is not supported by this collection.
      • addAllIterable

        boolean addAllIterable​(java.lang.Iterable<? extends T> iterable)
        Specified by:
        addAllIterable in interface MutableCollection<T>
        Throws:
        java.lang.UnsupportedOperationException - the addAllIterable operation is not supported by this collection.
        See Also:
        Collection.addAll(Collection)
      • addAll

        boolean addAll​(java.util.Collection<? extends T> collection)
        Specified by:
        addAll in interface java.util.Collection<T>
        Throws:
        java.lang.UnsupportedOperationException - the addAll operation is not supported by this collection.
      • remove

        boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<T>
        Throws:
        java.lang.UnsupportedOperationException - the remove operation is not supported by this collection.
      • removeAll

        boolean removeAll​(java.util.Collection<?> collection)
        Specified by:
        removeAll in interface java.util.Collection<T>
        Throws:
        java.lang.UnsupportedOperationException - the removeAll method is not supported by this collection.
      • removeAllIterable

        boolean removeAllIterable​(java.lang.Iterable<?> iterable)
        Specified by:
        removeAllIterable in interface MutableCollection<T>
        Throws:
        java.lang.UnsupportedOperationException - the removeAllIterable method is not supported by this collection.
        See Also:
        Collection.removeAll(Collection)
      • removeIf

        boolean removeIf​(Predicate<? super T> predicate)
        Description copied from interface: MutableCollection
        Removes all elements in the collection that evaluate to true for the specified predicate.
        e.g.
         return lastNames.removeIf(Predicates.isNull());
         
        Specified by:
        removeIf in interface MutableCollection<T>
        Throws:
        java.lang.UnsupportedOperationException - the removeIf method is not supported by this collection.
      • removeIfWith

        <P> boolean removeIfWith​(Predicate2<? super T,​? super P> predicate,
                                 P parameter)
        Description copied from interface: MutableCollection
        Removes all elements in the collection that evaluate to true for the specified predicate2 and parameter.
         return lastNames.removeIfWith(Predicates2.isNull(), null);
         
        Specified by:
        removeIfWith in interface MutableCollection<T>
        Throws:
        java.lang.UnsupportedOperationException - the removeIfWith method is not supported by this collection.
      • retainAll

        boolean retainAll​(java.util.Collection<?> collection)
        Specified by:
        retainAll in interface java.util.Collection<T>
        Throws:
        java.lang.UnsupportedOperationException - the retainAll method is not supported by this collection.
      • retainAllIterable

        boolean retainAllIterable​(java.lang.Iterable<?> iterable)
        Specified by:
        retainAllIterable in interface MutableCollection<T>
        Throws:
        java.lang.UnsupportedOperationException - the retainAllIterable method is not supported by this collection.
        See Also:
        Collection.retainAll(Collection)
      • clear

        void clear()
        Specified by:
        clear in interface java.util.Collection<T>
        Throws:
        java.lang.UnsupportedOperationException - the clear method is not supported by this collection.