java8新特性-foreach&lambda

      ArrayList objects = new ArrayList<>();
        for (int j = 0; j < 100; j++) {
            objects.add(j);
        }

        for (Object object : objects) {
            System.out.print(object);
        }

        objects.forEach(e->{
            System.out.print(e);
        });

        objects.parallelStream().forEach(e->{
            System.out.print(e);
        });

 
  

                            
                        
                    
                    
                    

你可能感兴趣的:(java8新特性-foreach&lambda)