DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2008

    is there syntax error

    hi,someone plz tell if thr is any syntax error in the following code-

    public LinkedList findOrdersForProduct(Product p, boolean debug) {
    ArrayList l = new ArrayList();
    ArrayList list = getAllOrders();
    for (int i=0; i<list.size(); i++) {
    Order order = (Order) list.get(0);
    boolean found = false;
    if (order.getProducts().size() > 0) {
    for (int j=0; j<=order.getProducts().size(); j++) {
    Product p2 = order.getProducts().get(j);
    found = (p2 == p);
    if (found && order != null)
    return new LinkedList(l);

  2. #2
    Join Date
    Dec 2004
    San Bernardino County, California
    what does the compiler tell you?

    You probably want to change the "0" in this statement to "i"
    Order order = (Order) list.get(0);

    Why not use "generics" in defining your containers? Then you will be assured that your list returned by getOrders() has only Orders as elements. Provides you automatic type checking
    Last edited by nspils; 11-03-2009 at 07:35 AM.

Similar Threads

  1. Replies: 0
    Last Post: 04-03-2009, 03:13 AM
  2. syntax error from function in include file
    By larryy@indiana. in forum ASP.NET
    Replies: 1
    Last Post: 03-20-2009, 01:29 PM
  3. SQL Statement
    By shers in forum Database
    Replies: 4
    Last Post: 06-17-2006, 04:01 AM
  4. I can't link FreeImage to C#
    By mesh2005 in forum .NET
    Replies: 1
    Last Post: 03-06-2006, 08:16 AM
  5. Syntax Error Updating SQL Server Table
    By Ralf in forum Database
    Replies: 26
    Last Post: 08-08-2002, 08:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.