//package com.nowjava;
/*
N o w J a v a . c o m
*/
import java.util.List;
public class Main {
public static void main(String[] argv) throws Exception {
List list = java.util.Arrays.asList("asdf", "nowjava.com");
Object o = "nowjava.com";
System.out.println(moveUp(list, o));
}
@SuppressWarnings("unchecked")
public static boolean moveUp(List list, Object o) {
int index = list.indexOf(o);
if (index >= 0) {/*来自 nowjava*/
try {
Object temp = list.set(index - 1, o);
list.set(index, temp);
return true;
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。