Java Reference
In-Depth Information
Useful Methods of the Collections Class
Method
Description
Searches a sorted list for a given element
value and returns its index
binarySearch(list, value)
Copies all elements from the source list to
the destination list
copy(destinationList, sourceList)
Replaces every element in the given list
with the given value
fill(list, value)
Returns the element with the highest value
max(list)
Returns the element with the lowest value
min(list)
Replaces all occurrences of the old value
with the new value
replaceAll(list, oldValue, newValue)
Reverses the order of the elements in the
given list
reverse(list)
Shifts each element to the right by the given
number of indexes, moving the final elements
to the front
rotate(list, distance)
Rearranges the elements into random order
shuffle(list)
Rearranges the elements into sorted (nonde-
creasing) order
sort(list)
Switches the element values at the given
two indexes
swap(list, index1, index2)
Useful Methods of DrawingPanel Objects
Method
Description
Returns a reference to the Graphics object that can be used
to draw onto the panel
getGraphics()
Sets the background color of the panel to the given color (the
default is white)
setBackground(color)
 
 
Search WWH ::




Custom Search