private void handlePrefixedCounting(String item,int count,String prefix,Map<String,Integer> redundantMap){
  StringBuilder key=new StringBuilder(prefix);
  key.append(item);
  if (!player.has(LOOTED_ITEMS,key.toString())) {
    player.put(LOOTED_ITEMS,key.toString(),0);
  }
  if (!redundantMap.containsKey(item)) {
    redundantMap.put(item,0);
  }
  int current=player.getInt(LOOTED_ITEMS,key.toString());
  int increased=current + count;
  redundantMap.put(item,increased);
  player.put(LOOTED_ITEMS,key.toString(),increased);
}

private void handlePrefixedCounting ( String item , int count , String prefix , Map < String , Integer > redundantMap ) { StringBuilder key = new StringBuilder ( prefix ) ; key . append ( item ) ; if ( ! player . has ( LOOTED_ITEMS , key . toString ( ) ) ) { player . put ( LOOTED_ITEMS , key . toString ( ) , 0 ) ; } if ( ! redundantMap . containsKey ( item ) ) { redundantMap . put ( item , 0 ) ; } int current = player . getInt ( LOOTED_ITEMS , key . toString ( ) ) ; int increased = current + count ; redundantMap . put ( item , increased ) ; player . put ( LOOTED_ITEMS , key . toString ( ) , increased ) ; }
handles redundant storage of counted items in player object and a separate map
