
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
AmitDiwan has Published 10744 Articles

AmitDiwan
771 Views
At first, initialize a double value −double val = 978.65;Now, convert the Double to Integer value using intValue() method −Double d = new Double(val); int res = d.intValue();ExampleFollowing is the program to convert Double to Integer in Java −public class Demo { public static void main(String args[]) { ... Read More

AmitDiwan
407 Views
At first, set an Interator −Iteratoriterator = Arrays.asList(50, 100, 200, 400, 500, 1000).iterator();Now, we have used stream −Streamstream = convertIterator(iterator);Above, the method convertIterator() is used for conversion. Following is the method −public static Stream convertIterator(Iterator iterator) { return StreamSupport.stream(((Iterable) () -> iterator).spliterator(), false); }ExampleFollowing is the program to ... Read More

AmitDiwan
1K+ Views
Let us first create a set with string values −Setset = new HashSet(Arrays.asList("One", "Two", "Three", "Four", "Five", "Six"));Now, convert it to a comma separated string using String.join() −String str = String.join(", ", set);ExampleFollowing is the program to convert set of string to a comma separated string in Java −import java.util.*; ... Read More

AmitDiwan
585 Views
At first, let’s say the following is our List of String −List myList = new ArrayList(Arrays.asList("One", "Two", "Three", "Four"));Now, convert this to a comma separated string using String.join()String str = String.join(", ", myList);ExampleFollowing is the program to convert List of String to a comma separated String in Java −import java.util.*; ... Read More

AmitDiwan
185 Views
At first, let us create a Java Map and initialize −Map map = new HashMap(); map.put(1, "Tom"); map.put(2, "John"); map.put(3, "Kevin"); map.put(4, "Jacob"); map.put(5, "Ryan");Now, convert the Map to List −ArrayList key = new ArrayList(map.keySet()); ArrayList value = new ArrayList(map.values());ExampleFollowing is the program to convert Maps to List in Java ... Read More

AmitDiwan
118 Views
Let’s say the following is our string −String str = "My String";Now, convert the above to IntStream −IntStream stream = str.chars();ExampleFollowing is the program to convert String to IntStream in Java −import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { String str = ... Read More

AmitDiwan
151 Views
Let’s first create an IntStream −IntStream stream = "Ryan".chars();Now, convert this IntStream to String −String str = stream.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString();ExampleFollowing is the program to convert IntStream to String in Java −import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { IntStream stream = "Ryan".chars(); ... Read More

AmitDiwan
803 Views
At first create a HashMap −Map map = new HashMap(); map.put("1", "One"); map.put("2", "Two"); map.put("3", "Three"); map.put("4", "Four"); map.put("5", "Five"); map.put("6", "Six");Now, convert the above HashMap to TreeMap −Map treeMap = new TreeMap(); treeMap.putAll(map);ExampleFollowing is the program to convert HashMap to TreeMap in Java −import java.util.*; import java.util.stream.*; public class ... Read More

AmitDiwan
191 Views
A boxed array is an array which is defined in the form of an object, instead of the primitives.ExampleFollowing is the program to convert Boxed Array to Stream in Java −import java.util.*; import java.util.stream.*; public class Demo { public static void main(String args[]) { String arr[] ... Read More

AmitDiwan
185 Views
Iterator in Java is used to traverse each and every element in the collection. Using it, traverse, obtain each element or you can even remove elements from ArrList. To use an iterator to cycle through the contents of a collection, at first obtain an iterator to the start of the ... Read More