KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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)
Tags (comma-separated)
Save Edits
Cancel