Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ensembl.util
Class LongSet

    java.lang.Object
      java.util.AbstractCollection
          java.util.AbstractSet
              java.util.HashSet
                  org.ensembl.util.LongSet

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Collection, java.io.Serializable, java.util.Set

Direct Known Subclasses:
  IDSet

public class LongSet
extends java.util.HashSet

Set for storing unique longs.

Author:
  Craig Melsopp
See Also:
  Serialized Form

Field Summary
`protected long[]` | `arrayCache`

Constructor Summary
`LongSet()` Create an empty set.
`LongSet(java.util.Collection s)` Creates a set of Longs from _s_.
`LongSet(java.util.Collection s, java.lang.Class c)` Creates a set of Longs from various collections.
`LongSet(long[] longs)` Creates a set of Longs ids.

Method Summary
`boolean` | `add(long l)`
`boolean` | `add(java.lang.Long l)`
`boolean` | `add(java.lang.Object l)` This method throws an exception as it should not be used.
`void` | `addAll(long[] ls)`
`boolean` | `contains(long l)`
`long[]` | `to_longArray()`
`long[]` | `to_longArray(boolean ascendingSort)`
`static long[]` | `to_longArray(java.util.Collection c)` Creates an Array from a collection of Longs.

Methods inherited from class java.util.HashSet
`clear, clone, contains, isEmpty, iterator, remove, size`

Methods inherited from class java.util.AbstractSet
`equals, hashCode, removeAll`

Methods inherited from class java.util.AbstractCollection
`addAll, containsAll, retainAll, toArray, toArray, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Set
`addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray`

Field Detail

### arrayCache

    protected long[] arrayCache

Constructor Detail

### LongSet

    public LongSet()

  Create an empty set.

### LongSet

    public LongSet(java.util.Collection s)

  Creates a set of Longs from _s_.

Parameters:
  `s` - collection of zero or more Longs.

### LongSet

    public LongSet(java.util.Collection s,
                   java.lang.Class c)

  Creates a set of Longs from various collections. If c==Persistent.class then each item in _s_ is added to the set as new Long(persistent.getInternalID()).

Parameters:
  `s` - collection of zero or more Longs or zero or more Persistents.
  `c` - type of data in _s_. Currently must be Long or Persistent.
See Also:
  `Long`, `Persistent`

### LongSet

    public LongSet(long[] longs)

  Creates a set of Longs ids.

Parameters:
  `longs` - zero or more longs.

Method Detail

### addAll

    public void addAll(long[] ls)

### add

    public boolean add(long l)

### add

    public boolean add(java.lang.Long l)

### add

    public boolean add(java.lang.Object l)

  This method throws an exception as it should not be used. Use add(long) or add(Long) instead.

  Throws:
    `java.lang.IllegalArgumentException`
  See Also:
    `add(long)`, `add(Long)`

### to_longArray

    public long[] to_longArray()

### to_longArray

    public long[] to_longArray(boolean ascendingSort)

### to_longArray

    public static long[] to_longArray(java.util.Collection c)

  Creates an Array from a collection of Longs.

  Parameters:
    `c` - collection of Longs.
  Returns:
    array of longs corresponding to Longs in collection.

### contains

    public boolean contains(long l)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD