« first day (2234 days earlier)      last day (2699 days later) » 

1:25 AM
Is there a way to initialize an Array with an algorithm in one line? Like: arr = [i*i for(int i=0; i<30; i++)];
 
 
3 hours later…
4:02 AM
@Unknown may be using streams
 
4:23 AM
Hi
 
 
9 hours later…
1:38 PM
Morning, Java!
 
Good morning Java
 
 
1 hour later…
2:48 PM
!!meow
 
3:11 PM
!!meow
 
4:10 PM
I want to loop through a list of strings, and print out the first letter in each string:
String firstLetters = list.stream().map(s->s.substring(0)).collect(Collectors.joining(""));
this seems ti ignore the substring and just prints the full strings (not the first letter)
 
4:26 PM
you need to set the size parameter of sub string (it's default is -1 which is entire text) so
String firstLetters = list.stream().map(s->s.substring(0,1)).collect(Collectors.joining(""));
 
ah yes
how would i print the tring without assigning it to a new string
thanks btw
 

« first day (2234 days earlier)      last day (2699 days later) »