boolean (String nameToOrder, String anchorName, boolean above) { int index = myFavoritesRootsOrder.indexOf(anchorName); int toReorder = myFavoritesRootsOrder.indexOf(nameToOrder); if (index ==-1 || toReorder ==-1 || index == toReorder) return false; if (toReorder == index -1 && above) return false; if (toReorder == index + 1 && !above) return false; return true; }