Java tutorial
import java.util.Arrays; public class Main { public static void main(String[] args) { String[] array = { "Java", "C#", "Scala", "Basic", "C++", "Ruby", "Pyton", "Perl", "Haskell", "Jet" }; System.out.println("\nStrings that contain ?e? first, everything else second: "); Arrays.sort(array, (s1, s2) -> { if (s1.contains("e") && s2.contains("e")) { return 0; } else if (s1.contains("e")) { return -1; } else { return 1; } }); Arrays.asList(array).forEach(System.out::println); } }