@Test public void testGetPeerSequence() throws Exception { assertNotNull(NodeIdConv.getPeerSequence(null)); assertNotNull(NodeIdConv.getPeerSequence(NodeIdConv.createPeerSequence(null))); assertEquals(nodeIds1, NodeIdConv.getPeerSequence(NodeIdConv.createPeerSequence(nodeIds1))); assertNotEquals(nodeIds1, NodeIdConv.getPeerSequence(NodeIdConv.createPeerSequence(nodeIds2))); }
public static List<NodeId> getPeerSequence(PeerSequence peerSequence) { if (peerSequence == null || peerSequence.getPeer() == null || peerSequence.getPeer().isEmpty()) { return new ArrayList<>(); } return peerSequence.getPeer() .stream() .sorted(Comparator.comparingInt(Peer::getSeq)) .map(Peer::getNodeId) .collect(Collectors.toList()); }
NodeIdConv { public static List<NodeId> getPeerSequence(PeerSequence peerSequence) { if (peerSequence == null || peerSequence.getPeer() == null || peerSequence.getPeer().isEmpty()) { return new ArrayList<>(); } return peerSequence.getPeer() .stream() .sorted(Comparator.comparingInt(Peer::getSeq)) .map(Peer::getNodeId) .collect(Collectors.toList()); } }
NodeIdConv { public static List<NodeId> getPeerSequence(PeerSequence peerSequence) { if (peerSequence == null || peerSequence.getPeer() == null || peerSequence.getPeer().isEmpty()) { return new ArrayList<>(); } return peerSequence.getPeer() .stream() .sorted(Comparator.comparingInt(Peer::getSeq)) .map(Peer::getNodeId) .collect(Collectors.toList()); } private  NodeIdConv(); }
NodeIdConv { public static List<NodeId> getPeerSequence(PeerSequence peerSequence) { if (peerSequence == null || peerSequence.getPeer() == null || peerSequence.getPeer().isEmpty()) { return new ArrayList<>(); } return peerSequence.getPeer() .stream() .sorted(Comparator.comparingInt(Peer::getSeq)) .map(Peer::getNodeId) .collect(Collectors.toList()); } private  NodeIdConv(); static NodeId _decode(byte[] array); static NodeId create(int nodeId); static NodeId createNodeId(InetAddress inetAddress); static NodeId createNodeId(String prefix); static PeerSequence createPeerSequence(List<NodeId> nodeIds); static List<NodeId> decode(byte[] array); static boolean equalTo(NodeId nodeId1, NodeId nodeId2); static List<NodeId> getPeerSequence(PeerSequence peerSequence); static byte[] toBytes(List<NodeId> nodesIds); static byte[] toBytes(NodeId nodeId); static String toString(NodeId nodeId); static String toString(PeerSequence peerSequence); }
NodeIdConv { public static List<NodeId> getPeerSequence(PeerSequence peerSequence) { if (peerSequence == null || peerSequence.getPeer() == null || peerSequence.getPeer().isEmpty()) { return new ArrayList<>(); } return peerSequence.getPeer() .stream() .sorted(Comparator.comparingInt(Peer::getSeq)) .map(Peer::getNodeId) .collect(Collectors.toList()); } private  NodeIdConv(); static NodeId _decode(byte[] array); static NodeId create(int nodeId); static NodeId createNodeId(InetAddress inetAddress); static NodeId createNodeId(String prefix); static PeerSequence createPeerSequence(List<NodeId> nodeIds); static List<NodeId> decode(byte[] array); static boolean equalTo(NodeId nodeId1, NodeId nodeId2); static List<NodeId> getPeerSequence(PeerSequence peerSequence); static byte[] toBytes(List<NodeId> nodesIds); static byte[] toBytes(NodeId nodeId); static String toString(NodeId nodeId); static String toString(PeerSequence peerSequence);  }