code: private boolean countTransitions(String groupStart,
                                       GroupTransition transitive,
                                       String groupEnd,
                                       Deque<GroupTransition> found,
                                       boolean first)
      {
          final String groupIn = transitive.getIn();
          final String groupOut = transitive.getOut();
          int count = 0;
          for (final Transition transition : mapTransition.getTransitions())
          {
              final boolean valid = groupIn.equals(transition.getIn()) && groupOut.equals(transition.getOut());
              if (valid && !groupOut.equals(groupStart) && !groupIn.equals(groupEnd))
              {
                  count++;
              }
          }
          if (count >= VALID_TRANSITIONS && (found.isEmpty() || found.getLast().getOut().equals(groupIn)))
          {
              found.add(transitive);
              return false;
          }
          return first;
      }
docs: Count the number of transitions and check if pass is still first or not. Add valid transitive to list.
  
  @param groupStart The first group.
  @param transitive The current group transition.
  @param groupEnd The last group.
  @param found Transitions found.
  @param first <code>true</code> if first pass, <code>false</code> else.
  @return <code>true</code> if still first pass, <code>false</code> else.