I want to order an ArrayList of strings by length, but not just in numeric order.
Say for example, the list contains these words:
cucumber
aeronomical
bacon
tea
telescopic
fantasmagorical
They need to be ordered by their difference in length to a special string, for example:
intelligent
So the final list would look like this (difference in brackets):
aeronomical (0)
telescopic (1)
fantasmagorical (3) - give priority to positive differences? doesn't really matter
cucumber (3)
bacon (6)
tea (8)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…