package Ġorg . du ang s use . l iterate kt Ċ Ċ type alias ĠCharSequence Map < V > Ġ= ĠMap < CharSequence , ĠV > Ċ /** Ċ Ġ* ĠA Ġdata Ġobject Ġmaps Ġstring Ġobject Ġby Ġtheir Ġ[ prefixes ], Ġlonger Ġfirst . Ċ Ġ*/ Ċ class ĠPrefix Map < out ĠV >( private Ġval Ġprefixes : ĠCharSequence Map < V >): ĠCharSequence Map < V > Ġby Ġprefixes Ġ{ ĊĠ Ġoverride Ġfun Ġget ( key : ĠCharSequence ): ĠV ? Ġ= Ġprefixes [ longest Prefix ( key )] ĊĠ Ġprivate Ġfun Ġlongest Prefix ( key : ĠCharSequence ): ĠCharSequence ? Ġ= Ġprefixes . keys ĊĠĠĠ Ġ. sorted By Descending ( CharSequence :: length ) ĊĠĠĠ Ġ. first OrNull Ġ{ Ġkey . startsWith ( it ) Ġ} Ċ }