question: private static void addInPathOrder ( final List < Cookie > list , final Cookie addCookie ) { int i = 0 ; for ( i = 0 ; i < list . size ( ) ; i ++ ) { final Cookie c = list . get ( i ) ; if ( addCookie . compare ( addCookie , c ) > 0 ) { break ; } } list . add ( i , addCookie ) ; }
target:  Adds the given cookie into the given list in descending path order. That is, more specific path to least specific paths. This may not be the fastest algorythm, but it'll work OK for the small number of cookies we're generally dealing with.