Insert current pair into the map
map . putIfAbsent ( sum , new ArrayList < > ( ) ) ; map . get ( sum ) . add ( new Pair ( i , j ) ) ; } } System . out . print ( " No ▁ such ▁ non - overlapping ▁ pairs ▁ present " ) ; }