Class Bag

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>

    public class Bag
    extends java.lang.Object
    implements java.util.Collection<java.lang.Object>
    Bag collection implementation.
    • Constructor Summary

      Constructors 
      Constructor Description
      Bag()
      Constructor.
      Bag​(java.util.Collection<?> arg0)
      Constructor parameterized with an existing collection.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(java.lang.Object arg0)
      boolean addAll​(java.util.Collection<?> arg0)
      void clear()
      boolean contains​(java.lang.Object arg0)
      boolean containsAll​(java.util.Collection<?> arg0)
      boolean isEmpty()
      java.util.Iterator<java.lang.Object> iterator()
      boolean remove​(java.lang.Object arg0)
      boolean removeAll​(java.util.Collection<?> arg0)
      boolean retainAll​(java.util.Collection<?> arg0)
      int size()
      java.lang.Object[] toArray()
      java.lang.Object[] toArray​(java.lang.Object[] arg0)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • Bag

        public Bag()
        Constructor.
      • Bag

        public Bag​(java.util.Collection<?> arg0)
        Constructor parameterized with an existing collection.
        Parameters:
        arg0 - the collection
    • Method Detail

      • add

        public boolean add​(java.lang.Object arg0)
        Specified by:
        add in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.add(java.lang.Object)
      • addAll

        public boolean addAll​(java.util.Collection<?> arg0)
        Specified by:
        addAll in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.addAll(java.util.Collection)
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.clear()
      • contains

        public boolean contains​(java.lang.Object arg0)
        Specified by:
        contains in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.contains(java.lang.Object)
      • containsAll

        public boolean containsAll​(java.util.Collection<?> arg0)
        Specified by:
        containsAll in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.containsAll(java.util.Collection)
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.isEmpty()
      • remove

        public boolean remove​(java.lang.Object arg0)
        Specified by:
        remove in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.remove(java.lang.Object)
      • removeAll

        public boolean removeAll​(java.util.Collection<?> arg0)
        Specified by:
        removeAll in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.removeAll(java.util.Collection)
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.size()
      • iterator

        public java.util.Iterator<java.lang.Object> iterator()
        Specified by:
        iterator in interface java.util.Collection<java.lang.Object>
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Object>
        See Also:
        Collection.iterator()
      • retainAll

        public boolean retainAll​(java.util.Collection<?> arg0)
        Specified by:
        retainAll in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.retainAll(java.util.Collection)
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.toArray()
      • toArray

        public java.lang.Object[] toArray​(java.lang.Object[] arg0)
        Specified by:
        toArray in interface java.util.Collection<java.lang.Object>
        See Also:
        Collection.toArray(Object[])