private static Stream < Node > streamAttributes ( Node node ) { final NamedNodeMap attributes = node . getAttributes ( ) ; if ( attributes == null ) return Stream . empty ( ) ; return IntStream . range ( 0 , attributes . getLength ( ) ) . mapToObj ( attributes :: item ) ; }
Needs to be thread - safe