You can create a comparator using an explicit order, e.g.
List<String> order = Arrays.asList("Orange", "Apple", "WaterMelon");
Comparator<String> comp
= Comparator.comparingInt(name -> order.indexOf(name)-Integer.MIN_VALUE);
which can be used as
List<Fruit> genericFruitList = fruits
.sorted(Comparator.comparing(fruit -> fruit.getName(), comp))
.collect(Collectors.toList());
however, sorting the entire list, especially using the comparator List.indexOf, can be inefficient. An alternative would be
List<Fruit> genericFruitList = fruits
.collect(Collectors.groupingBy(fruit -> fruit.getName()))
.entrySet().stream()
.sorted(Map.Entry.comparingByKey(comp))
.flatMap(e -> e.getValue().stream())
.collect(Collectors.toList());
Fruit .
Bucket Sort.