|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ListOfBuckets<E>
public class ListOfBuckets<E>
This class represents a list of buckets, storing values at specified indices.
Constructor Summary | |
---|---|
ListOfBuckets(int numBuckets)
Constructs a list of buckets of a given size |
Method Summary | |
---|---|
void |
add(int bucketNum,
E newItem)
Adds an item to the specified bucket |
java.util.ArrayList<E> |
asList()
Converts the list of buckets into an ArrayList, preserving the order of items |
void |
clear()
Clears each bucket in the list |
java.util.ArrayList<E> |
getBucket(int bucketNum)
Accesses the items stored in a particular bucket |
int |
numBuckets()
Determines the number of buckets in the list |
int |
numStored()
Determines the total number of items stored in the list |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ListOfBuckets(int numBuckets)
numBuckets
- the number of buckets in the listMethod Detail |
---|
public int numBuckets()
public int numStored()
public void add(int bucketNum, E newItem)
bucketNum
- the bucket number (0 <= bucketNum < numBuckets())newItem
- the item to be added to that bucketpublic java.util.ArrayList<E> getBucket(int bucketNum)
bucketNum
- the bucket number (0 <= bucketNum < numBuckets())
public void clear()
public java.util.ArrayList<E> asList()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |