public List<String> calculateImports(){
  List<String> stdlibResult=new ArrayList<>();
  List<String> thirdPartyResult=new ArrayList<>();
  List<String> appResult=new ArrayList<>();
  for (  PythonImport protoImport : stringImports.values()) {
switch (protoImport.type()) {
case STDLIB:
      stdlibResult.add(protoImport.importString());
    break;
case THIRD_PARTY:
  thirdPartyResult.add(protoImport.importString());
break;
case APP:
appResult.add(protoImport.importString());
break;
}
}
Collections.sort(stdlibResult);
Collections.sort(thirdPartyResult);
Collections.sort(appResult);
List<String> all=new ArrayList<>();
if (stdlibResult.size() > 0) {
all.addAll(stdlibResult);
all.add("");
}
if (thirdPartyResult.size() > 0) {
all.addAll(thirdPartyResult);
all.add("");
}
all.addAll(appResult);
return all;
}

public List < String > calculateImports ( ) { List < String > stdlibResult = new ArrayList < > ( ) ; List < String > thirdPartyResult = new ArrayList < > ( ) ; List < String > appResult = new ArrayList < > ( ) ; for ( PythonImport protoImport : stringImports . values ( ) ) { switch ( protoImport . type ( ) ) { case STDLIB : stdlibResult . add ( protoImport . importString ( ) ) ; break ; case THIRD_PARTY : thirdPartyResult . add ( protoImport . importString ( ) ) ; break ; case APP : appResult . add ( protoImport . importString ( ) ) ; break ; } } Collections . sort ( stdlibResult ) ; Collections . sort ( thirdPartyResult ) ; Collections . sort ( appResult ) ; List < String > all = new ArrayList < > ( ) ; if ( stdlibResult . size ( ) > 0 ) { all . addAll ( stdlibResult ) ; all . add ( "" ) ; } if ( thirdPartyResult . size ( ) > 0 ) { all . addAll ( thirdPartyResult ) ; all . add ( "" ) ; } all . addAll ( appResult ) ; return all ; }
calculate the imports map and return a sorted set of python import output strings .
