Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は次のような配列を持っていますString[] selectedJobs = {"job,1","job,2", "Job2,1", "job3,1"};
String[] selectedJobs = {"job,1","job,2", "Job2,1", "job3,1"};
のような情報を抽出したい
Job -> 1,2 Job2 -> 1 Job3 -> 1 Map<String, List<String>> jobs = new HashMap<String, List<String>>();
そして、対応する整数のリストとともに各ジョブをマップに格納したいと思います。
これを行う方法 ?
何を試しましたか?アルゴリズムはトリッキーであってはなりません。配列を調べ、文字列ごとに「、」で分割し、記述したHashMapに配置します。