Here you can find the source of moveItemIdInSecond(final List
private static List<String> moveItemIdInSecond(final List<String> list)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Jens Kristian Villadsen. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html/*www . j a v a 2 s . c om*/ * * Contributors: * Jens Kristian Villadsen - Lead developer, owner and creator ******************************************************************************/ import java.util.List; public class Main { private static List<String> moveItemIdInSecond(final List<String> list) { final boolean noItemKind = moveItemKindInFirst(list); if (list.contains("dmap.itemid")) { if (list.size() > 1) { list.remove("dmap.itemid"); int index = 1; if (noItemKind) { index = 0; } list.add(index, "dmap.itemid"); } } return list; } private static boolean moveItemKindInFirst(final List<String> list) { boolean noItemKind = true; if (list.contains("dmap.itemkind")) { list.remove("dmap.itemkind"); list.add(0, "dmap.itemkind"); noItemKind = false; } return noItemKind; } }