Program: 157704
Project: 157704
Buggy source:
private static void buildLists(){
  underlyingSetCodesPerFormat.put(STANDARD,new ArrayList<>());
  underlyingSetCodesPerFormat.put(EXTENDED,new ArrayList<>());
  underlyingSetCodesPerFormat.put(FRONTIER,new ArrayList<>());
  underlyingSetCodesPerFormat.put(MODERN,new ArrayList<>());
  underlyingSetCodesPerFormat.put(VINTAGE_LEGACY,new ArrayList<>());
  underlyingSetCodesPerFormat.put(CUSTOM,new ArrayList<>());
  final Map<String,ExpansionInfo> expansionInfo=new HashMap<>();
  formats.clear();
  for (  ExpansionInfo set : ExpansionRepository.instance.getAll()) {
    expansionInfo.put(set.getName(),set);
    formats.add(set.getName());
    underlyingSetCodesPerFormat.put(set.getName(),new ArrayList<>());
    underlyingSetCodesPerFormat.get(set.getName()).add(set.getCode());
    if (set.getType() == SetType.CUSTOM_SET) {
      underlyingSetCodesPerFormat.get(CUSTOM).add(set.getCode());
      continue;
    }
    underlyingSetCodesPerFormat.get(VINTAGE_LEGACY).add(set.getCode());
    if (set.getType() == SetType.CORE || set.getType() == SetType.EXPANSION || set.getType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL) {
      if (STANDARD_CARDS.getSetCodes().contains(set.getCode())) {
        underlyingSetCodesPerFormat.get(STANDARD).add(set.getCode());
      }
      if (set.getReleaseDate().after(extendedDate)) {
        underlyingSetCodesPerFormat.get(EXTENDED).add(set.getCode());
      }
      if (set.getReleaseDate().after(frontierDate)) {
        underlyingSetCodesPerFormat.get(FRONTIER).add(set.getCode());
      }
      if (set.getReleaseDate().after(modernDate)) {
        underlyingSetCodesPerFormat.get(MODERN).add(set.getCode());
      }
    }
    if (set.getType() == SetType.EXPANSION && set.getBlockName() != null) {
      String blockDisplayName=getBlockDisplayName(set.getBlockName());
      underlyingSetCodesPerFormat.computeIfAbsent(blockDisplayName,k -> new ArrayList<>());
      underlyingSetCodesPerFormat.get(blockDisplayName).add(set.getCode());
      if (expansionInfo.get(blockDisplayName) == null) {
        expansionInfo.put(blockDisplayName,set);
        formats.add(blockDisplayName);
      }
      if (expansionInfo.get(blockDisplayName).getReleaseDate().after(set.getReleaseDate())) {
        expansionInfo.put(blockDisplayName,set);
      }
    }
    if (set.getType() == SetType.SUPPLEMENTAL && set.getBlockName() != null) {
      expansionInfo.putIfAbsent(set.getBlockName(),set);
      if (expansionInfo.get(set.getBlockName()).getReleaseDate().before(set.getReleaseDate())) {
        expansionInfo.put(set.getBlockName(),set);
      }
    }
  }
  formats.sort((name1,name2) -> {
    ExpansionInfo expansionInfo1=expansionInfo.get(name1);
    ExpansionInfo expansionInfo2=expansionInfo.get(name2);
    if (expansionInfo1.getType().compareTo(expansionInfo2.getType()) == 0) {
      SetType setType=expansionInfo1.getType();
switch (setType) {
case EXPANSION:
        if (expansionInfo1.getBlockName() == null) {
          if (expansionInfo2.getBlockName() == null) {
            return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
          }
          return 1;
        }
      if (expansionInfo2.getBlockName() == null) {
        return -1;
      }
    if (name1.endsWith("String_Node_Str") && name2.endsWith("String_Node_Str")) {
      return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
    }
  if (name1.endsWith("String_Node_Str")) {
    if (expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
      return -1;
    }
  }
if (name2.endsWith("String_Node_Str")) {
  if (expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
    return 1;
  }
}
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
case SUPPLEMENTAL:
if (expansionInfo1.getBlockName() == null) {
if (expansionInfo2.getBlockName() == null) {
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
return -1;
}
if (expansionInfo2.getBlockName() == null) {
return 1;
}
if (expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
if (expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate()) == 0) {
return name1.compareTo(name2);
}
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
if (expansionInfo1.getBlockName().startsWith("String_Node_Str")) {
if (expansionInfo1.getBlockName().startsWith("String_Node_Str")) {
return 1;
}
return 1;
}
if (expansionInfo2.getBlockName().startsWith("String_Node_Str")) {
return -1;
}
ExpansionInfo blockInfo1=expansionInfo.get(expansionInfo1.getBlockName());
ExpansionInfo blockInfo2=expansionInfo.get(expansionInfo2.getBlockName());
return blockInfo2.getReleaseDate().compareTo(blockInfo1.getReleaseDate());
default :
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
}
return expansionInfo1.getType().compareTo(expansionInfo2.getType());
}
);
if (!formats.isEmpty()) {
formats.add(0,CUSTOM);
formats.add(0,VINTAGE_LEGACY);
formats.add(0,MODERN);
formats.add(0,EXTENDED);
formats.add(0,FRONTIER);
formats.add(0,STANDARD);
}
formats.add(0,ALL);
}

Fixed version (ground truth):
private static void buildLists(){
  underlyingSetCodesPerFormat.put(STANDARD,new ArrayList<>());
  underlyingSetCodesPerFormat.put(EXTENDED,new ArrayList<>());
  underlyingSetCodesPerFormat.put(FRONTIER,new ArrayList<>());
  underlyingSetCodesPerFormat.put(MODERN,new ArrayList<>());
  underlyingSetCodesPerFormat.put(VINTAGE_LEGACY,new ArrayList<>());
  underlyingSetCodesPerFormat.put(CUSTOM,new ArrayList<>());
  final Map<String,ExpansionInfo> expansionInfo=new HashMap<>();
  formats.clear();
  for (  ExpansionInfo set : ExpansionRepository.instance.getAll()) {
    expansionInfo.put(set.getName(),set);
    formats.add(set.getName());
    underlyingSetCodesPerFormat.put(set.getName(),new ArrayList<>());
    underlyingSetCodesPerFormat.get(set.getName()).add(set.getCode());
    if (set.getType() == SetType.CUSTOM_SET) {
      underlyingSetCodesPerFormat.get(CUSTOM).add(set.getCode());
      continue;
    }
    underlyingSetCodesPerFormat.get(VINTAGE_LEGACY).add(set.getCode());
    if (set.getType() == SetType.CORE || set.getType() == SetType.EXPANSION || set.getType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL) {
      if (STANDARD_CARDS.getSetCodes().contains(set.getCode())) {
        underlyingSetCodesPerFormat.get(STANDARD).add(set.getCode());
      }
      if (set.getType() != SetType.SUPPLEMENTAL_STANDARD_LEGAL) {
        if (set.getReleaseDate().after(extendedDate) && (set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)) {
          underlyingSetCodesPerFormat.get(EXTENDED).add(set.getCode());
        }
        if (set.getReleaseDate().after(frontierDate) && (set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)) {
          underlyingSetCodesPerFormat.get(FRONTIER).add(set.getCode());
        }
        if (set.getReleaseDate().after(modernDate) && (set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE)) {
          underlyingSetCodesPerFormat.get(MODERN).add(set.getCode());
        }
      }
    }
    if (set.getType() == SetType.EXPANSION && set.getBlockName() != null) {
      String blockDisplayName=getBlockDisplayName(set.getBlockName());
      underlyingSetCodesPerFormat.computeIfAbsent(blockDisplayName,k -> new ArrayList<>());
      underlyingSetCodesPerFormat.get(blockDisplayName).add(set.getCode());
      if (expansionInfo.get(blockDisplayName) == null) {
        expansionInfo.put(blockDisplayName,set);
        formats.add(blockDisplayName);
      }
      if (expansionInfo.get(blockDisplayName).getReleaseDate().after(set.getReleaseDate())) {
        expansionInfo.put(blockDisplayName,set);
      }
    }
    if (set.getType() == SetType.SUPPLEMENTAL && set.getBlockName() != null) {
      expansionInfo.putIfAbsent(set.getBlockName(),set);
      if (expansionInfo.get(set.getBlockName()).getReleaseDate().before(set.getReleaseDate())) {
        expansionInfo.put(set.getBlockName(),set);
      }
    }
  }
  formats.sort((name1,name2) -> {
    ExpansionInfo expansionInfo1=expansionInfo.get(name1);
    ExpansionInfo expansionInfo2=expansionInfo.get(name2);
    if (expansionInfo1.getType().compareTo(expansionInfo2.getType()) == 0) {
      SetType setType=expansionInfo1.getType();
switch (setType) {
case EXPANSION:
        if (expansionInfo1.getBlockName() == null) {
          if (expansionInfo2.getBlockName() == null) {
            return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
          }
          return 1;
        }
      if (expansionInfo2.getBlockName() == null) {
        return -1;
      }
    if (name1.endsWith("String_Node_Str") && name2.endsWith("String_Node_Str")) {
      return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
    }
  if (name1.endsWith("String_Node_Str")) {
    if (expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
      return -1;
    }
  }
if (name2.endsWith("String_Node_Str")) {
  if (expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
    return 1;
  }
}
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
case SUPPLEMENTAL:
if (expansionInfo1.getBlockName() == null) {
if (expansionInfo2.getBlockName() == null) {
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
return -1;
}
if (expansionInfo2.getBlockName() == null) {
return 1;
}
if (expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
if (expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate()) == 0) {
return name1.compareTo(name2);
}
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
if (expansionInfo1.getBlockName().startsWith("String_Node_Str")) {
if (expansionInfo1.getBlockName().startsWith("String_Node_Str")) {
return 1;
}
return 1;
}
if (expansionInfo2.getBlockName().startsWith("String_Node_Str")) {
return -1;
}
ExpansionInfo blockInfo1=expansionInfo.get(expansionInfo1.getBlockName());
ExpansionInfo blockInfo2=expansionInfo.get(expansionInfo2.getBlockName());
return blockInfo2.getReleaseDate().compareTo(blockInfo1.getReleaseDate());
default :
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
}
return expansionInfo1.getType().compareTo(expansionInfo2.getType());
}
);
if (!formats.isEmpty()) {
formats.add(0,CUSTOM);
formats.add(0,VINTAGE_LEGACY);
formats.add(0,MODERN);
formats.add(0,EXTENDED);
formats.add(0,FRONTIER);
formats.add(0,STANDARD);
}
formats.add(0,ALL);
}