public class countstringfromlist {
public static void main(String[] args) {
List<String> s1=Arrays.asList("aju","nima","vima","aju");
Map<String,Long> ngg=s1.stream().
collect(Collectors.groupingBy(s->s,Collectors.counting()));
ngg.forEach((k,v)->System.out.println(k+" "+v));
}
}