Method convertToUppercaseStrings

Method convertToUppercaseStrings (lines 52–61) changes lowercase String elements in its List argument to uppercase Strings. Line 54 calls List method listIterator to get the List’s bidirectional iterator (i.e., one that can traverse a List backward or forward). ListIterator is also a generic class. In this example, the ListIterator references String objects, because method listIterator is called on a List of Strings. Line 56 calls method hasNext to determine whether the List contains another element. Line 58 gets the next String in the List. Line 59 calls String method toUpperCase to get an uppercase version of the String and calls ListIterator method set to replace the current String to which iterator refers ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.