

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert integer to String with Map
Let’s say we have an Integer array with the following elements:
20, 50, 100, 200, 250, 300, 500, 550, 600, 700
Convert it to List:
Arrays.asList(20, 50, 100, 200, 250, 300, 500, 550, 600, 700)
Use Map to get the values greater than 400 and convert to String:
filter(val -> val > 400) .map(val -> "Value greater than 400 = " + String.valueOf(val))
The following is an example to convert integer to String with Map:
Example
import java.util.Arrays; public class Demo { public static void main(String[] args) { Arrays.asList(20, 50, 100, 200, 250, 300, 500, 550, 600, 700) .stream() .filter(val -> val > 400) .map(val -> "Value greater than 400 = " + String.valueOf(val)) .forEach(val -> System.out.println(val)); } }
Output
Value greater than 400 = 500 Value greater than 400 = 550 Value greater than 400 = 600 Value greater than 400 = 700
- Related Questions & Answers
- Java Program to convert from integer to String
- Java Program to convert from String to integer
- Java Program to convert String to Integer using Integer.parseInt()
- C# Program to Convert Integer to String
- How to convert String to Integer and Integer to String in Java?
- C# program to convert binary string to Integer
- Java Program to convert a Map to a read only map
- Convert Integer to Hex String in Java
- Java Program to convert integer to boolean
- Java Program to convert integer to octal
- Java Program to convert integer to hexadecimal
- Java Program to convert boolean to integer
- Program to convert List of Integer to List of String in Java
- Program to convert List of String to List of Integer in Java
- Program to convert Set of Integer to Set of String in Java
Advertisements