This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Java 8 + Lambda  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is doing following code:

public class Main{

   public static void main(String[] args) {

       Arrays.asList(args).stream()
               .filter(s -> s.length()>=10)
               .map(s -> s.substring(0,10))
               .forEach(System.out::println);
   }
}
 
Bartender
Posts: 2163
92
Eclipse IDE Google Web Toolkit Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vadiks Charny wrote:What is doing following code...


Did you try it ?
Does it have any compilation error ?
Is the output not to your expectations ? (If yes, then please explain what you feel should have been the output)
 
salvin francis
Bartender
Posts: 2163
92
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And most importantly ...
Welcome to Coderanch  
 
Vadiks Charny
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No output for this code...
No compilation or other errors...
 
Saloon Keeper
Posts: 9799
197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

That code will only give any output if you supply command line parameters that are at least 10 characters long.

Can you show us the command you're using to run the application?
 
salvin francis
Bartender
Posts: 2163
92
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vadiks Charny wrote:No output for this code...


So, this answers my First and Second question, you did try it and you did not get any compilation errors. Now for my 3rd question..
Are you expecting no output ? (Stephan has given good hints about this)
 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!