private void ensureDefaultGroupSequenceIsExpandable(List<Group> groupList, List<Group> defaultGroupList, int defaultGroupIndex) { for ( int i = 0; i < defaultGroupList.size(); i++ ) { Group group = defaultGroupList.get( i ); if ( Group.DEFAULT_GROUP.equals( group ) ) { continue; // we don't have to consider the default group since it is the one we want to replace } int index = groupList.indexOf( group ); // check whether the sequence contains group of the default group sequence if ( index == -1 ) { continue; // if the group is not in the sequence we can continue } if ( ( i == 0 && index == defaultGroupIndex - 1 ) || ( i == defaultGroupList.size() - 1 && index == defaultGroupIndex + 1 ) ) { // if we are at the beginning or end of he defaultGroupSequence and the matches are either directly before resp after we can continue as well, // since we basically have two groups continue; } throw log.getUnableToExpandDefaultGroupListException( defaultGroupList, groupList ); } }
private void ensureDefaultGroupSequenceIsExpandable(List<Group> groupList, List<Group> defaultGroupList, int defaultGroupIndex) { for ( int i = 0; i < defaultGroupList.size(); i++ ) { Group group = defaultGroupList.get( i ); if ( Group.DEFAULT_GROUP.equals( group ) ) { continue; // we don't have to consider the default group since it is the one we want to replace } int index = groupList.indexOf( group ); // check whether the sequence contains group of the default group sequence if ( index == -1 ) { continue; // if the group is not in the sequence we can continue } if ( ( i == 0 && index == defaultGroupIndex - 1 ) || ( i == defaultGroupList.size() - 1 && index == defaultGroupIndex + 1 ) ) { // if we are at the beginning or end of he defaultGroupSequence and the matches are either directly before resp after we can continue as well, // since we basically have two groups continue; } throw LOG.getUnableToExpandDefaultGroupListException( defaultGroupList, groupList ); } }