2
0

More than 3 years have passed since last update.

ラムダ式を使ってリスト配列からローマ字を大文字から小文字に変換するプログラム

Posted at

ラムダ式を使ってリスト配列からローマ字を大文字から小文字に変換するプログラムを作りました。


// 乃木坂新4期生メンバーをローマ字の大文字から小文字に変換する
// Create  2021/7/3
// Author  乃木坂好きのITエンジニア
//
//
//

//APIのimport
import java.util.ArrayList;
import java.util.Scanner;


class NewYonki {
    public static void main(String[] args) {
        ArrayList<String> name_list = new ArrayList<String>();
        Scanner sc = new Scanner(System.in);
        System.out.println("人数を5人ローマ字大文字で入力してください");
        for(int i=0;i<5;i++) {
            String line = sc.nextLine();
            name_list.add(line);
        }
        //ラムダ関数でリスト配列の要素を全て小文字にする
        name_list.replaceAll(s -> s.toLowerCase());
        System.out.println(name_list);
    sc.close();

    }
}

ラムダ関数を使うとプログラム作成が楽ですね

2
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
2
0