subprojects/parseq-zk-client/src/main/java/com/linkedin/parseq/zk/client/ZKUtil.java
public static String findNodeWithNextLowestSN(List<String> children, String node) {
    List<String> sortedChildren = children.stream()
        .sorted((String o1, String o2) ->
            Long.compare(getSequenceNumber(o1), getSequenceNumber(o2)))
        .collect(Collectors.toList());

    int index = sortedChildren.indexOf(node);
    if (index > 0) {
      return sortedChildren.get(index-1);
    } else if (index == 0) {
      return node;
    } else {
      return null;
    }
  }
public static String findNodeWithNextLowestSN(List<String> children, String node) {
    List<String> sortedChildren = children.stream()
        .sorted((String o1, String o2) ->
            Long.compare(getSequenceNumber(o1), getSequenceNumber(o2)))
        .collect(Collectors.toList());

    int index = sortedChildren.indexOf(node);
    if (index > 0) {
      return sortedChildren.get(index-1);
    } else if (index == 0) {
      return node;
    } else {
      return null;
    }
  }
public static String findNodeWithNextLowestSN ( List < String > children , String node ) { List < String > sortedChildren = children . stream ( ) . sorted ( ( String o1 , String o2 ) -> Long . compare ( getSequenceNumber ( o1 ) , getSequenceNumber ( o2 ) ) ) . collect ( Collectors . toList ( ) ) ; int index = sortedChildren . indexOf ( node ) ; if ( index > 0 ) { return sortedChildren . get ( index - 1 ) ; } else if ( index == 0 ) { return node ; } else { return null ; } }
Finds node with next lowest sequence number than the given node within
the given list of nodes.

@param children list of children
@param node the given node to compare sequence number with
@return the node with next lowest sequence number
Finds node with next lowest sequence number than the given node within the given list of nodes .