1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ラムダ式を使った配列の実験(Java編)

Posted at

ラムダ式を使った配列の実験(Java編)です。

package nogizaka
// ラムダ式の実験プログラム
// 2021/6/20 新規作成
// Author 乃木坂好きのITエンジニア


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

//ラムダ式実験プログラム
public class hairetsu_test {
	public static void main(String[] args) {
		//配列
		List<Integer> data = new ArrayList<Integer>(Arrays.asList(1,2,3,4,5,6,7,8,9,10,11,12));
        //ラムダ式で3で割り切れない数字を要素から削除する
		data.removeIf( (Integer i) -> { return i % 3 !=0; } );
		System.out.println(data);
	}
}

勉強をかねてラムダ式を使ってプログラムを作りました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?