|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.comp211.laundry.list.BiListUtil
public class BiListUtil
Singleton class holding the utility methods on BiLists used in the Laundry Simulation.
Field Summary | |
---|---|
static BiListUtil |
ONLY
Singleton instance |
Method Summary | ||
---|---|---|
|
delete(BiListI<T> host,
T elt)
Deletes the first occurrence of elt from host. |
|
|
deleteMatchFront(BiListI<T> host,
Predicate<T> pred,
T nullValue)
Delete the first occurrence of an element for which the given Predicate returns true. |
|
|
deleteMatchRear(BiListI<T> host,
Predicate<T> pred,
T nullValue)
Delete the first occurrence of an element for which the given Predicate returns true. |
|
|
mapDelete(BiListI<BiListI<T>> host,
T elt)
Deletes the first occurrence of elt in each list (of type BiList) in host. |
|
|
remListFront(BiListI<T> host,
int size)
Removes the first size elements from host and returns them as the result. |
|
|
toStringWithCommas(BiListI<T> host)
Generates a string representation for host with items separated by ", " and no leading or trailing text. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final BiListUtil ONLY
Method Detail |
---|
public <T> boolean delete(BiListI<T> host, T elt)
T
- the type of the element being deleted -- inferred from host and elt.host
- the list to delete fromthe
- element to delete
public <T> boolean mapDelete(BiListI<BiListI<T>> host, T elt)
T
- the type of element that is being deleted -- inferred from host and elthost
- the list to delete fromelt
- the element to delete
public <T> T deleteMatchFront(BiListI<T> host, Predicate<T> pred, T nullValue)
T
- The type of element to be removed -- inferred from host, pred and nullValuehost
- the list to delete frompred
- the Predicate to usenullValue
- the value used to represent not finding an element to delete.
public <T> T deleteMatchRear(BiListI<T> host, Predicate<T> pred, T nullValue)
T
- The type of element to be removed -- inferred from host, pred and nullValuehost
- the list to delete frompred
- the Predicate to usenullValue
- the value used to represent not finding an element to delete.
public <T> BiListI<T> remListFront(BiListI<T> host, int size)
T
- the type of elements to remove -- inferred from hosthost
- the list to remove fromsize
- the maximum number of elements to remove
public <T> String toStringWithCommas(BiListI<T> host)
T
- the type of elements being processed -- inferred from hosthost
- the list to process
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |