Here you can find the source of splitIdKeyConfig(String config)
Parameter | Description |
---|---|
config | a parameter |
public static Map<String, String> splitIdKeyConfig(String config)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.*; public class Main { /**//w w w . jav a 2s. c o m * split a keyid string into a map * * @param config * @return */ public static Map<String, String> splitIdKeyConfig(String config) { //example confing: mp@rec-mp,blub,test-rec@test-rec-key //key , id pair HashMap<String, String> result = new HashMap<>(); String[] split = config.split(","); for (String s : split) { //id should be something like mp@mp-test -> id@display-name if (s != null && !s.isEmpty()) { if (s.contains("@")) { String[] idSplit = s.split("@"); if (idSplit.length > 1) { result.put(idSplit[1], idSplit[0]); } } else { //if no @ is available the key equals the id result.put(s, s); } } } return result; } }