create a map of vectors to store Diagonal elements
HashMap < Integer , Vector < Integer > > diagonalPrint = new HashMap < > ( ) ; diagonalPrintUtil ( root , 0 , diagonalPrint ) ; System . out . println ( " Diagonal ▁ Traversal ▁ of ▁ Binnary ▁ Tree " ) ; for ( Entry < Integer , Vector < Integer > > entry : diagonalPrint . entrySet ( ) ) { System . out . println ( entry . getValue ( ) ) ; } }