About 50 results
Open links in new tab
  1. Reverse a string in Java - Stack Overflow

    One natural way to reverse a String is to use a StringTokenizer and a stack. Stack is a class that implements an easy-to-use last-in, first-out (LIFO) stack of objects.

  2. How can I reverse a single String in Java 8 using Lambda and Streams?

    I have one string say "Aniruddh" and I want to reverse it using lambdas and streams in Java 8. How can I do it?

  3. string - Reverse a given sentence in Java - Stack Overflow

    6 Just split it on a space character into a string array, then loop over the array in reverse order and construct the output string.

  4. Reversing a String with Recursion in Java - Stack Overflow

    The function takes the first character of a String - str.charAt(0) - puts it at the end and then calls itself - reverse() - on the remainder - str.substring(1), adding these two things together to get its result - …

  5. What is the most efficient algorithm for reversing a String in Java ...

    Mar 14, 2010 · String reversed = new StringBuilder(s).reverse().toString(); If you need to implement it yourself, then iterate over the characters in reverse order and append them to a StringBuilder. You …

  6. Reverse a string using stack Java

    Feb 3, 2024 · The purpose of a stack in reversing a string is to make use of its Last In, First Out (LIFO) property. When you push characters of the string onto a stack and then pop them, they come out in …

  7. java - Reverse string printing method - Stack Overflow

    Apr 13, 2021 · But for large string appending character with + operator can be inefficient. And reversing string with above approach will result in wrong for uni-code mismatches.

  8. list - How can I reverse a Java 8 stream and generate a decrementing ...

    Reversing a Stream prior to Java version 21 without using a customized collection type is more verbose, typically requiring an extra line to reverse the resulting list.

  9. java - Reverse a string without using string functions - Stack Overflow

    Aug 2, 2016 · Closed 12 years ago. How to write a java program to reverse a string without using string functions?

  10. java - How do I reverse every string in a string array? - Stack Overflow

    May 19, 2020 · Using this method I am trying to reverse every single string in the string array but it just throws an exception. The array's length and elements are being inputed with scanner.