What do you want to save?
Add Code snippet
New code examples
-
Java 2022-03-28 03:35:55
Java
//create ArrayList ArrayList<String> arrayList = new ArrayList<String>(); //add item to ArrayList arrayList.add("item"); //check if ArrayList contains item (returns boolean) System.out.println(arrayList.contains("item")); /... Add solution -
Java 2022-03-27 21:35:04
Sort string array in case insensitive order and case sensitive order java
import java.util.Arrays; public class SortStringArrayDemo { public static void main(String[] args) { String[] fruits = new String[5]; fruits[0] = "Mango"; fruits[1] = "cherries"; fruits[2] = "Apple&q... Add solution -
Java 2022-03-27 20:40:19
TreeSet headSet(E toElement) method in java
import java.util.Iterator; import java.util.TreeSet; public class TreeSetHeadSetEToElementMethodExample { public static void main(String[] args) { TreeSet<Integer> ts = new TreeSet<Integer>(); TreeSet<Integer> hs = new ... Add solution -
Java 2022-03-27 16:45:39
TreeMap clear() method in java
import java.util.TreeMap; public class TreeMapClearMethodExample { public static void main(String[] args) { TreeMap<Integer, String> tm = new TreeMap<Integer, String>(); tm.put(8, "red"); tm.put(12, "blue... Add solution -
Java 2022-03-26 13:40:11
generate all prime number less than n java
/** Author: Jeffrey Huang As far as I know this is almost the fastest method in java for generating prime numbers less than n. A way to make it faster would be to implement Math.sqrt(i) instead of i/2. I don't know if you could implement sieve of eratost... Add solution
Best helpers
Ranking is empty