Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8257961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:22:39+00:00 2026-06-08T02:22:39+00:00

I am building an application which allows restaurant guests to order food and send

  • 0

I am building an application which allows restaurant guests to order food and send to server.

What i have considered is to

1) create a class Order.java class

public class Order
{

private Intger  tableId;
private Integer restaurantId;
private Integer foodId;
private Integer foodQuantity;

getter and setters
}

2) This class object will be populated with guests order and an ArrayList of objects of the class will be sent to server as Gson String.

Now if an order consist of some 7 items, Then the arraylist will have 7 objects, but tableId and restaurantId will be same 7 times.

can you suggest a better design where in I can associate restaurantId and tableId with the entire arraylist.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:22:41+00:00Added an answer on June 8, 2026 at 2:22 am

    There is no right solution, it would depend on your needs, one possible solution would be something like:

    public class Order {
    
        private int tableId;
        private int restaurant;
        private List<OrderItem> items;
    
        // setters and getters
    
    }
    
    public class OrderItem {
    
        private int itemId; // foodId
        private int quatity; // foodQuantity
    
        // setters and getters
    
    }
    

    But if you were in a situation that the information comes not normalized, like you suggested (in which tableId is repeated for every single food ordered), I would consider to implement a normalization process that will return a structure with the classes I draft above. But if you are implementing it, please consider to make it as normalized as possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a Rails application which allows a user to create an object
I have a task form for an application I am building which allows me
So I am building an app which have a File Transfer application which allows
I am building a cryptographic web application, which allows user to sign and encrypt
I'm building an application which will be able to send emails at any specific
i'm building an android application which have a chat. in this chat i each
I'm building a java application which works in a LAN environment, every computer on
I am building a Monotouch application which downloads data from the server encrypted using
I'm building an application as part of a course project which allows users to
I'm building a solution for a client which allows them to create very basic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.