if
boolean b = false;
if (b = true){
System.out.println("true");
}else{
System.out.println("false");
}
switch
while
int i = 0;
while(i++ < 10);{
System.out.println("a");
}
Is only incremented by i.
break Only loops (for, while) and switches can be used
class Orange{
int i;
Orange(){
this(this.i);
}
Orange(int i){}
}
public static void main(String[] args) {
String ary[] = new String[3];
System.out.println(ary.length); // => 3
StringBuilder sb = new StringBuilder(3);
System.out.println(sb.length()); // => 0
List<String> list = new ArrayList<String>(3);
System.out.println(list.size()); // => 0
}
public interface Portable<Integer>{
public void handCarry(Integer weight);
}
When using a lambda expression
Portable p = (Integer w) -> System.out.println(w);
Portable<Integer> p = (Integer w) -> System.out.println(n);
Portable p = w -> System.out.println(w);
System.out.println(Stream.of("a", "b", "c", "d").parallel().reduce((x,y)->x+"-"+y).get()); // =>Always a-b-c-d
Stream.of("a", "b", "c", "d").parallel().forEach(System.out::print); // =>In no particular order a, b, c,d is output
Recommended Posts