code: private static Circuit getCircuitGroups(String group, Collection<String> neighborGroups)
      {
          final Collection<String> set = new HashSet<>(neighborGroups);
          final Circuit circuit;
          if (set.size() > 1)
          {
              final Iterator<String> iterator = set.iterator();
              final String groupIn = iterator.next();
              final String groupOut = iterator.next();
              final CircuitType type = getCircuitType(group, neighborGroups);
  
              if (groupIn.equals(group))
              {
                  circuit = new Circuit(type, group, groupOut);
              }
              else
              {
                  circuit = new Circuit(type, group, groupIn);
              }
          }
          else
          {
              circuit = null;
          }
          return circuit;
      }
docs: Get the tile circuit between two groups.
  
  @param group The initial group.
  @param neighborGroups The neighbor groups.
  @return The tile circuit, <code>null</code> if invalid groups number.