FileDocCategorySizeDatePackage
WatchList.javaAPI DocExample2750Tue Jun 03 23:09:44 BST 1997None

WatchList.java

// This example is from the book Developing Java Beans by Robert Englander. 
// Copyright (c) 1997 O'Reilly & Associates.
// You may study, use, modify, and distribute this example for any purpose.
// This example is provided WITHOUT WARRANTY either expressed or implied.

// Chapter 4 -- The WatchList class

import java.util.*;

public class WatchList
{
   // a vector that contains the actual stock names
   protected Vector stocks = new Vector();
   
   // constructor
   public WatchList()
   {
   }

   // the get method for the StockCount property
   public synchronized int getStockCount()
   {
      // the StockCount property is derived from the size of the
      // stocks Vector
      return stocks.size();
   }

   // get method for Stocks property array
   public synchronized String[] getStocks()
   {
      // we don