Java ListIterator previous() MethodThe previous() method of ListIterator interface is used to return the previous element from the list and moves the cursor in a backward position. The above method can be used to iterate the list in a backward direction. SyntaxParametersNA ReturnThe above method is used to return the previous element of the given list. Throws:NoSuchElementException- If the given iteration has no such previous elements. Example 1Test it NowOutput: The list of alphabets is given as : [88, 67, 57] In the forward direction : 88 67 57 In the backward direction:- 57 67 88 Example 2Test it NowOutput: The list of electrical appliances is given as : [Fan, Tubelight, Bulb, Television] In the forward direction : Fan Tubelight Bulb Television In the backward direction:- Television Bulb Tubelight Fan Example 3Test it NowOutput: The list of alphabets is given as : [R, E, A, L] In the forward direction : R E A L In the backward direction:- L A E R Next TopicJava ListIterator |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India