Examples: containsValue method (Item - Java)

This agent appends a value to a list if the list does not already contain the value.

import lotus.domino.*;
import java.util.Vector;
import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      DocumentCollection dc = db.getAllDocuments();
      Document doc = dc.getFirstDocument();
      if (doc != null) {
        Item item = doc.getFirstItem("textListItem");
        if (!item.containsValue("Motorcycle"))
          item.appendToTextList("Motorcycle");
        if (!item.containsValue("Airplane"))
          item.appendToTextList("Airplane");
        doc.save();
        }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}