Created
April 9, 2014 15:49
-
-
Save sjyun/10285249 to your computer and use it in GitHub Desktop.
java8 예제1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package java8; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Test8 { | |
public static void main(String ar[]){ | |
List<String> list = new ArrayList<>(); | |
list.add("하이트"); | |
list.add("카스"); | |
list.add("처음처럼"); | |
list.add("참이슬"); | |
list.add("시원"); | |
list.add("청하"); | |
list.add("이과두주"); | |
list.forEach( value -> System.out.println( value )); | |
StringBuilder builder = new StringBuilder(); | |
list.forEach( value -> builder.append(value)); | |
System.out.println(builder.toString()); | |
list.removeIf( value -> value.length() < 3); | |
System.out.println(list); | |
list.sort((first, second) -> first.compareTo(second)); | |
System.out.println(list); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment