- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to filter String stream and map to lower case in Java? Perform sort as well.
Let’s say the following is String array, which we have converted to List −
Arrays.asList("DE", "GH", "JK", "MN", "PQ", "RS", "TU", "VW", "XY", "BC")
Now filter String stream and map to lower case −
.stream() .filter(a-> a.startsWith("V")) .map(String::toLowerCase)
To sort now, use the sorted() and display using forEach().
The following is an example to filter string stream and map to lowercase −
Example
import java.util.Arrays; public class Demo { public static void main(String[] args) throws Exception { Arrays.asList("DE", "GH", "JK", "MN", "PQ", "RS", "TU", "VW", "XY", "BC") .stream() .filter(a-> a.startsWith("V")) .map(String::toLowerCase) .sorted() .forEach(System.out::println); } }
Output
Vw
- Related Articles
- Java String to Lower Case example.
- How to approach String as int stream in Java
- Java Program to Map String list to lowercase and sort
- Java Program to sort String Stream with reversed Comparator
- Convert mixed case string to lower case in JavaScript
- How to convert std::string to lower case in C++?
- Java program to count upper and lower case characters in a given string
- How to convert a string in lower case in Golang?
- How to perform sort using Java?
- Program to convert a Map to a Stream in Java
- How to sort Map values by key in Java?
- How to Map IntSteam to String object in Java
- How to convert string Stream to join them in Java?
- How to convert a string into the lower case using JavaScript?
- Java Program to Find Maximum Odd Number in Array Using Stream and Filter

Advertisements