Old question, new answer (for Java 8)
IntStream.range(0, 10).forEach(n -> System.out.println(n));
or with method references:
IntStream.range(0, 10).forEach(System.out::println);
More Related Contents:
- creating a simple symmetric table in java [closed]
- Finding The Area Of A Triangle
- Java default constructor
- Handling InterruptedException in Java
- Subclassing a Java Builder class
- Why do I get java.lang.AbstractMethodError when trying to load a blob in the db?
- JLabel mouse events for Drag and Drop
- java.sql.SQLException: Column count doesn’t match value count at row 1
- java: Class.isInstance vs Class.isAssignableFrom
- Issue with Game of Life
- Gmail login using selenium webdriver in java
- How to Execute SQL Script File in Java?
- Random “Element is no longer attached to the DOM” StaleElementReferenceException
- JPA & Criteria API – Select only specific columns
- How to use URLClassLoader to load a *.class file?
- Parsing string to local date doesn’t use desired century
- SimpleDateFormat.parse() ignores the number of characters in pattern
- How to Apply Custom Filters in a Camera [Surfaceview Preview]…?
- Why must a Java file have the same name as its public class? [duplicate]
- How do I use PostgreSQL JSON(B) operators containing a question mark “?” via JDBC
- Have JPA/Hibernate to replicate the “ON DELETE SET NULL” functionality
- compression and decompression of string data in java
- Wrong Manifest.mf in IntelliJ IDEA created .jar
- How to convert a double to long without casting?
- How to map a ResultSet with unknown amount of columns to a List and display it in a HTML table?
- logback: Two appenders, multiple loggers, different levels
- Play Framework 2: Read the application version defined in Build.scala
- Is there a testsuite for Java custom collections implementation?
- What does Cookie CsrfTokenRepository.withHttpOnlyFalse () do and when to use it?
- Write a method that merges two array lists, alternating elements from both array lists