public class

HashedList

extends AbstractList<E>
java.lang.Object
   ↳ java.util.AbstractCollection<E>
     ↳ java.util.AbstractList<E>
       ↳ com.pnfsoftware.jeb.util.collect.HashedList<E>

Class Overview

A List type suitable for long lists of unique items for which presence checks are often required. For typical list implementations, contains(Object) is in O(N) and therefore slow for long lists.

Limitations: Neither duplicate (per equals) nor null entries are allowed. Methods throw NullPointerException on attempts to insert null entries, and IllegalArgumentException on attempts to insert duplicates.

This class is not thread-safe. This class is serializable.

Summary

[Expand]
Inherited Fields
From class java.util.AbstractList
Public Constructors
HashedList()
HashedList(int initialCapacity)
HashedList(Collection<? extends E> c)
Public Methods
void add(int index, E element)
boolean contains(Object o)
Fast presence check, in O(log N) instead of O(N), the expected time complexity for search in a list.
boolean containsAll(Collection<?> c)
Fast presence check, in O(log N) instead of O(N).
E get(int index)
E remove(int index)
E set(int index, E element)
int size()
[Expand]
Inherited Methods
From class java.util.AbstractList
From class java.util.AbstractCollection
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.List

Public Constructors

public HashedList ()

public HashedList (int initialCapacity)

public HashedList (Collection<? extends E> c)

Parameters
c source collection, which should not contain duplicates or null entries

Public Methods

public void add (int index, E element)

public boolean contains (Object o)

Fast presence check, in O(log N) instead of O(N), the expected time complexity for search in a list.

public boolean containsAll (Collection<?> c)

Fast presence check, in O(log N) instead of O(N).

public E get (int index)

public E remove (int index)

public E set (int index, E element)

public int size ()