Java8のlambda構文がどのようにクロージャーではないかを読んで思ったのは、ラムダの外側の変数に対する処理がスレッドセーフなのかどうかという点です。というわけで早速試してみました。 スレッドセーフでない ArrayList クラスに対して並列で値を追加するというコードです。 public void test() { Integer[] array = new Integer[100000]; Arrays.fill(array,0); List<Integer> nums = Arrays.asList(array); Stream<Integer> stream = nums.stream(); List<Integer> list = new ArrayList<Integer>(); stream.parallel().forEach(s -> list.add(s)); Sy