Java 类org.apache.commons.collections.iterators.ReverseListIterator 实例源码

项目:java-util-examples    文件:ReverseElementsInList.java   
@Test 
public void reverse_elements_in_list_apache () {

    ReverseListIterator reverseListIterator = new ReverseListIterator(precipitation);

    List<String> reversePrecipitation = new ArrayList<String>();
    while (reverseListIterator.hasNext()) {
        reversePrecipitation.add( (String) reverseListIterator.next());
    }

    assertThat(reversePrecipitation, contains(
             "Drizzle", "Rain", "Freezing rain", 
             "Freezing drizzle", "Ice crystals", 
             "Hail", "Ice pellets", 
             "Snow grains", "Snow"));
}
项目:levelup-java-examples    文件:ReverseElementsInList.java   
@Test 
public void reverse_elements_in_list_apache () {

    ReverseListIterator reverseListIterator = new ReverseListIterator(precipitation);

    List<String> reversePrecipitation = new ArrayList<String>();
    while (reverseListIterator.hasNext()) {
        reversePrecipitation.add( (String) reverseListIterator.next());
    }

    assertThat(reversePrecipitation, contains(
             "Drizzle", "Rain", "Freezing rain", 
             "Freezing drizzle", "Ice crystals", 
             "Hail", "Ice pellets", 
             "Snow grains", "Snow"));
}
项目:softwarecave    文件:Main.java   
private static void iterateReverseListIterator(List<String> list) {
    System.out.print("\nApache ReverseListIterator:\n");
    Iterator<String> it = new ReverseListIterator(list);
    while (it.hasNext()) {
        System.out.println(it.next());
    }
}