org.apache.jena.atlas.lib
Class MultiSet<T>

java.lang.Object
  extended by org.apache.jena.atlas.lib.MultiSet<T>
All Implemented Interfaces:
Iterable<T>

public class MultiSet<T>
extends Object
implements Iterable<T>

A MultiSet - also known as a Bag


Constructor Summary
MultiSet()
           
 
Method Summary
 void add(T obj)
          Add an object
 void add(T obj, long n)
          Add an object, with cardinality n
 void clear()
           
 boolean contains(T obj)
          Does it contain the object?
 long count(T obj)
          Get the count of the number of times the object appears in the multiset - i.e.
 Iterator<T> elements()
          Yiled one object per element (i.e without counts)
 boolean isEmpty()
          Does it contain any elements at all?
 Iterator<T> iterator()
           
 void remove(T obj)
          Remove one occurrence of the object from the multiset
 void remove(T obj, long n)
          Remove N occurrences of the object from the multiset
 void removeAll(T obj)
          Remove all occurrences of the object in themultiset
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiSet

public MultiSet()
Method Detail

isEmpty

public boolean isEmpty()
Does it contain any elements at all?


contains

public boolean contains(T obj)
Does it contain the object?


elements

public Iterator<T> elements()
Yiled one object per element (i.e without counts)


add

public void add(T obj)
Add an object


add

public void add(T obj,
                long n)
Add an object, with cardinality n


remove

public void remove(T obj)
Remove one occurrence of the object from the multiset


remove

public void remove(T obj,
                   long n)
Remove N occurrences of the object from the multiset


removeAll

public void removeAll(T obj)
Remove all occurrences of the object in themultiset


clear

public void clear()

count

public long count(T obj)
Get the count of the number of times the object appears in the multiset - i.e. it's cardinality. Returns zero when not present.


size

public int size()

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

toString

public String toString()
Overrides:
toString in class Object


Licenced under the Apache License, Version 2.0