Quantcast
Channel: Collections.reverse method not reversing entry - Stack Overflow
Browsing latest articles
Browse All 6 View Live

Answer by 1218985 for Collections.reverse method not reversing entry

The reverse(List<?>) method is used to reverse the order of the elements in the specified list. Since there is only one item in your collection, reverse order is same as the initial list. You can...

View Article



Answer by Rahman for Collections.reverse method not reversing entry

If you want to reverse a String why are you adding it to a list ?Use this : String s = sc.next(); StringBuilder sb = new StringBuilder(s); System.out.println(sb.reverse());

View Article

Answer by Peter Lawrey for Collections.reverse method not reversing entry

If you have a collection of one, it is the same in reverse order as forward.If you want to reverse the string representation of an integer, you can use StringBuilder to reverse the digits.StringBuilder...

View Article

Answer by Ravindra babu for Collections.reverse method not reversing entry

Try this code.ArrayList al = new ArrayList();al.add(new StringBuffer(digit).reverse().toString());

View Article

Answer by Tunaki for Collections.reverse method not reversing entry

You misinterpreted what Collections.reverse does. This method reverses the list that you gave, not its content. Since you called this method with a list having a single element, the result will be the...

View Article


Collections.reverse method not reversing entry

My code below is supposed to accept an integer from the user, and then print whatever integer they enter in reverse order. I am getting no errors, but when I run this program the integer is not being...

View Article
Browsing latest articles
Browse All 6 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>