static List < String > pathParts ( String path ) { String [ ] pathParts = path . split ( "/" ) ; List < String > parts = new ArrayList <> ( pathParts . length ) ; String pathSoFar = "" ; for ( String pathPart : pathParts ) { if ( ! pathPart . equals ( "" ) ) { pathSoFar += "/" + pathPart ; parts . add ( pathSoFar ) ; } } return parts ; }
Parse a znode path and return a list containing the full paths to its constituent directories .