Input
String [] ss = {"-Dmyone=1","-Dmytwo=2","-Dmythree=3"}; 
ExpectedOutput:
Map<String,String> mapOb = {myone = 1, mytwo = 2, mythree = 3}
NOTE: I want to split the List of Strings by "=" and remove the "-D" and replace with empty string, and after splitting string if the length is not greater than 1 and then insert an empty Map.
Below is the snippet of Code I have written , but this causing an issue.
Map<String,String> collectMap = Arrays.stream(ss).flatMap(x -> {
        Map<String,String> expected = new HashMap<>();
        int splitIndex = x.indexOf("=");
        String [] keyValList = x.split("=");
        if(Arrays.stream(keyValList).count() > 1){
            Collectors.toMap(
              key -> x.substring(0,splitIndex).replace("-D", " "), 
              value -> x.substring(splitIndex +  1, x.length()));
        }
        else{
            Collections.<String,String>emptyMap();
        }
    }).collect(Collectors.toMap());
 
     
    