java.lang.Object BucketList<Type>
Type
- the type of value stored in the bucketspublic class BucketList<Type>
Class that implements a list of generic buckets.
Constructor Summary | |
---|---|
BucketList(int size)
Constructs a list of empty buckets. |
Method Summary | |
---|---|
void |
add(int bucketNum,
Type newItem)
Adds a new item to the specified bucket. |
java.util.ArrayList<Type> |
asList()
Converts the bucket list to a single, flat list. |
void |
clear()
Clears (makes empty) all of the buckets in the list. |
java.util.ArrayList<Type> |
getBucket(int bucketNum)
Accesses the specified bucket (as a list). |
int |
numStored()
Accesses the total number of items stored in the bucket list. |
int |
size()
Accesses the size of the bucket list. |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BucketList(int size)
size
- the number of empty buckets in the listMethod Detail |
---|
public void add(int bucketNum, Type newItem)
bucketNum
- the bucket number (starting at 0)newItem
- the item to be addedpublic java.util.ArrayList<Type> asList()
public void clear()
public java.util.ArrayList<Type> getBucket(int bucketNum)
bucketNum
- the bucket number (starting at 0)
public int numStored()
public int size()