private Stream < Deque < Archive > > makePaths ( Deque < Archive > path ) { Set < Archive > nodes = endPoints . get ( path . peekFirst ( ) ) ; if ( nodes == null || nodes . isEmpty ( ) ) { return Stream . of ( new LinkedList <> ( path ) ) ; } else { return nodes . stream ( ) . map ( n -> { Deque < Archive > newPath = new LinkedList <> ( ) ; newPath . addFirst ( n ) ; newPath . addAll ( path ) ; return newPath ; } ) ; } }
Prepend end point to the path