Java Reference
In-Depth Information
Useful Methods of the Character Class
Method
Description
Example
Converts a character that looks
like a number into that number
Character.getNumericValue('6') returns 6
getNumericValue(ch)
Tests whether the character is
one of the digits '0' through '9'
Character.isDigit('X') returns false
isDigit(ch)
Tests whether the character is in
the range 'a' to 'z' or 'A' to 'Z'
Character.isLetter('f') returns true
isLetter(ch)
Tests whether the character is a
lowercase letter
Character.isLowerCase('Q') returns false
isLowerCase(ch)
Tests whether the character is an
uppercase letter
Character.isUpperCase('Q') returns true
isUpperCase(ch)
Converts a character into the
lowercase version of the given
letter
Character.toLowerCase('Q') returns 'q'
toLowerCase(ch)
Converts a character into the
uppercase version of the given
letter
Character.toUpperCase('x') returns 'X'
toUpperCase(ch)
Useful Methods of the Collection Interface
Method
Description
Adds the specified element to this collection
add(element)
Adds all elements from the given collection to this collection
addAll(collection)
Removes all elements from this collection
clear()
Returns true if this collection contains the given element
contains(element)
Returns true if this collection contains all elements of the given collection
containsAll(collection)
Returns true if this collection contains no elements
isEmpty()
Returns an object that can be used to traverse the elements of this collection
iterator()
Removes one occurrence of the specified element, if it is contained in this collection
remove(element)
Removes all elements of the given collection from this collection
removeAll(collection)
Removes all elements not found in the given collection from this collection
retainAll(collection)
Returns the number of elements in this collection
size()
Returns an array containing the elements of this collection
toArray()
 
 
Search WWH ::




Custom Search