• 코드:
​x
 
1
import java.util.*;
2
import java.util.stream.*;
3
​
4
public class prog {
5
    public static void main(String[] args){
6
        Stream<String> stream = Stream.of("HTML", "CSS", "JAVA", "PHP");
7
        
8
        Map<Boolean, List<String>> patition = stream.collect(Collectors.partitioningBy(s -> (s.length() % 2) == 0));
9
        
10
        List<String> oddLengthList = patition.get(false);
11
        System.out.println(oddLengthList);
12
        
13
        List<String> evenLengthList = patition.get(true);
14
        System.out.println(evenLengthList);
15
    }
16
}
표준입력 & 실행옵션