Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.List; public class Main { public static String getListNextElement(String pre, List list) { String next = null; for (Iterator it = list.iterator(); it.hasNext();) { String obj = (String) it.next(); if (obj.equals(pre) && it.hasNext()) { next = (String) it.next(); break; } } return next; } }