Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to reverse a list in java

    List<String> stringList = Arrays.asList("A", "B", "C");
    Collections.reverse(stringList);
    assertThat(stringList).containsExactly("C", "B", "A");
Comment

Arraylist reverse in java

public static void main(String[] args) {

        ArrayList<Integer>list = new ArrayList<>();
        for(int i = 1; i < 6; i++){ // bu element index degil.
            list.add(i);
        }
        System.out.println(list); // [1, 2, 3, 4, 5]

        for (int i = list.size()-1; i >= 0; i--) {
            int each = list.get(i);  // unboxing
            System.out.print(each + " "); // 5 4 3 2 1
        }
Comment

PREVIOUS NEXT
Code Example
Java :: check if jcheckbox is checked java 
Java :: Unable to find bundled Java version. 
Java :: java swing timer sleep 
Java :: how to delete files in java 
Java :: papermc api maven 
Java :: multiply two strings 
Java :: java for loop 
Java :: access activity method from adapter 
Java :: selet all elemnts 
Java :: how to get only current date in java android studio 
Java :: simple date format 
Java :: java get unique elements from array 
Java :: java date time 
Java :: java.lang.NoSuchMethodError: org.apache.logging.log4j.spi.LoggerContextFactory.isClassLoaderDependent()Z after log4j update 
Java :: change button text when clicked android studio 
Java :: jagged array java 
Java :: console printing in java 
Java :: test if string is float java 
Java :: unparseable date error in java 
Java :: convert int to double with 2 decimal places java 
Java :: how to round up in java 
Java :: java resource file 
Java :: byte to bufferedimage java 
Java :: java obtain list string from list object 
Java :: java leap year expression 
Java :: full screen dialog android 
Java :: delay a function call in java 
Java :: java random word from list 
Java :: java scanner netLine 
Java :: get today date in java 8 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =