List of usage examples for java.util Vector clear
public void clear()
From source file:Main.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(i, 0);// w ww. j a v a 2 s . c o m } System.out.println(v); v.clear(); System.out.println(v); }
From source file:Main.java
public static void main(String[] args) { Vector<String> v = new Vector<String>(); v.add("1");//from w ww .j a v a2s . c o m v.add("2"); v.add("3"); System.out.println(v.size()); v.clear(); v.removeAllElements(); System.out.println(v.size()); }
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(i, 0);// ww w .j a v a2 s . c o m } System.out.println(v.capacity()); System.out.println(v); v.clear(); System.out.println(v); System.out.println(v.capacity()); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);/* w ww. j a v a 2 s . com*/ vec.add(3); vec.add(2); vec.add(1); // let us print the size of the vector System.out.println("Size of the vector after addition :" + vec.size()); System.out.println(vec); // let us clear the vector vec.clear(); // let us print the size of the vector System.out.println("Size of the vector after clearing :" + vec.size()); }
From source file:edu.ku.brc.specify.dbsupport.cleanuptools.FirstLastVerifier.java
/** * @param args//from www . j a va 2 s .c o m */ public static void main(String[] args) { if (true) { testLastNames(); return; } FirstLastVerifier flv = new FirstLastVerifier(); System.out.println(flv.isFirstName("Bill")); System.out.println(flv.isLastName("Bill")); System.out.println(flv.isFirstName("Johnson")); System.out.println(flv.isLastName("Johnson")); try { if (false) { for (String nm : new String[] { "firstnames", "lastnames" }) { File file = new File("/Users/rods/Downloads/" + nm + ".txt"); try { PrintWriter pw = new PrintWriter("/Users/rods/Downloads/" + nm + ".list"); for (String line : (List<String>) FileUtils.readLines(file)) { String[] toks = StringUtils.split(line, '\t'); if (toks != null && toks.length > 0) pw.println(toks[0]); } pw.close(); } catch (Exception e) { e.printStackTrace(); } } } Vector<String> lnames = new Vector<String>(); File file = XMLHelper.getConfigDir("lastnames.list"); if (false) { for (String name : (List<String>) FileUtils.readLines(file)) { if (flv.isFirstName(name)) { System.out.println(name + " is first."); } else { lnames.add(name); } } Collections.sort(lnames); FileUtils.writeLines(file, lnames); } lnames.clear(); file = XMLHelper.getConfigDir("firstnames.list"); for (String name : (List<String>) FileUtils.readLines(file)) { if (flv.isLastName(name)) { System.out.println(name + " is first."); } else { lnames.add(name); } } Collections.sort(lnames); //FileUtils.writeLines(file, lnames); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:net.sf.jabref.exporter.layout.WSITools.java
/** * @param vcr {@link java.util.Vector} of <tt>String</tt> * @param buf Description of the Parameter * @param delimstr Description of the Parameter * @return Description of the Return Value *//*from w w w . ja va 2 s . c o m*/ public static boolean tokenize(Vector<String> vcr, String buf, String delimstr) { vcr.clear(); buf = buf + '\n'; StringTokenizer st = new StringTokenizer(buf, delimstr); while (st.hasMoreTokens()) { vcr.add(st.nextToken()); } return true; }
From source file:Main.java
/** * * @param vtData Vector//from w w w . j av a 2 s . c o m * @param iComboIndex int * @param iVectorIndex int * @param cbo JComboBox * @param vt Vector * @param bClear boolean * @param bHaveNull boolean * @throws Exception */ public static void fillValue(Vector vtData, int iComboIndex, int iVectorIndex, JComboBox cbo, Vector vt, boolean bClear, boolean bHaveNull) throws Exception { // Clear if (bClear) { vt.clear(); cbo.removeAllItems(); } // Add null value if (bHaveNull) { vt.addElement(""); cbo.addItem(""); } // Fill value for (int iRowIndex = 0; iRowIndex < vtData.size(); iRowIndex++) { Vector vtResultRow = (Vector) vtData.elementAt(iRowIndex); vt.addElement(vtResultRow.elementAt(iVectorIndex)); cbo.addItem(vtResultRow.elementAt(iComboIndex)); } }
From source file:de.innovationgate.wgpublisher.bi.BiBase.java
public static String getBrowserLanguageKey(javax.servlet.jsp.PageContext pageContext) { Enumeration enumLocales = pageContext.getRequest().getLocales(); Vector vecLocales = new Vector(); vecLocales.clear(); String language = null;//from w w w . j a v a2 s. co m while (enumLocales.hasMoreElements()) vecLocales.add((Locale) enumLocales.nextElement()); for (int i = 0; i < vecLocales.size(); i++) { Locale currentLocale = (Locale) vecLocales.get(i); language = currentLocale.getLanguage().toUpperCase(); if (language.equalsIgnoreCase("DE") || language.equalsIgnoreCase("EN")) break; } if (language == null || language.equals("")) language = "EN"; return language; }
From source file:net.sf.jabref.exporter.layout.WSITools.java
/** * @param vcr {@link java.util.Vector} of <tt>String</tt> * @param s Description of the Parameter * @param delimstr Description of the Parameter * @param limit Description of the Parameter * @return Description of the Return Value *//*from w ww .j a v a 2 s. c o m*/ public static boolean tokenize(Vector<String> vcr, String s, String delimstr, int limit) { LOGGER.warn("Tokenize \"" + s + '"'); vcr.clear(); s = s + '\n'; int endpos; int matched = 0; StringTokenizer st = new StringTokenizer(s, delimstr); while (st.hasMoreTokens()) { String tmp = st.nextToken(); vcr.add(tmp); matched++; if (matched == limit) { endpos = s.lastIndexOf(tmp); vcr.add(s.substring(endpos + tmp.length())); break; } } return true; }
From source file:org.sakaiproject.content.tool.AttachmentAction.java
/** * Handle the eventSubmit_doRemove_all command to remove the selected attachment(s). *///from w w w . j a va2s . c o m static public void doRemove_all(RunData data) { if (!"POST".equals(data.getRequest().getMethod())) { return; } SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); // modify the attachments vector Vector attachments = (Vector) state.getAttribute(STATE_ATTACHMENTS); attachments.clear(); // end up in main mode state.setAttribute(STATE_MODE, MODE_MAIN); }