Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
java8 parallel sort
package helloJava8;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class LambdaExpr {
public static void main(String[] args) throws IOException {
List<Employee> list = new ArrayList<>();
list.add(new Employee("Muhammad", "Abdullah"));
list.add(new Employee("Ahmad", "Yaser"));
list.add(new Employee("Ahmad", "Abdullah"));, e2) -> e1.getFirstName().compareTo(e2.getFirstName()))
System.out.println("--------------"); -> e.getFirstName()))
static class Employee {
private String firstName;
private String lastName;
public Employee(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
public String getFirstName() {
return firstName;
public String getLastName() {
return lastName;
public String toString() {
return firstName + " " + lastName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.