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

  • SEARCH
  • Home
  • 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 7518163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:40:40+00:00 2026-05-30T01:40:40+00:00

Was just a quick question to see if there are different ways you code

  • 0

Was just a quick question to see if there are different ways you code something similar when it comes to evaluating conditional statements/control flow.

For example:

  • If Statements
  • Switch Statements

Is there any tidier way to do these as I have basically the option of If (value == X) { // do X } and Switch(value) { case X: ...

When doing this with over 100 values is there any data driven approach that could be taken or any different evaluation methods that would tidy up the code?

  • 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-05-30T01:40:41+00:00Added an answer on May 30, 2026 at 1:40 am

    If your values are integers and are not sparse sometimes it can be convenient to use a lookup table (both for data and for code – in this last case you’d use function pointers and is often called a jump table, which is incidentally what the compiler often does with switch blocks); if the alternative is checking the possible values one by one, the performance jumps from O(N) to O(1).

    Also, for non-integer data, hash tables can be used. How convenient they are depends from case to case.

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

Sidebar

Related Questions

Just had a quick question to throw out and see if there was a
Just a quick question, does anyone know if there are restrictions on creating Performance
just a quick question. For some reason i cannot see the default web parts
I just have a quick question to see if this is possible with the
Just a quick regex question...hopefully I have a string that looks something like this:
just a quick question: I am a CS undergrad and have only had experience
just a quick question, if I have a matrix has n rows and m
Just a quick question about ReadWriteLocks in Java (specifically the ReentrantReadWriteLock implementation) as I
Just a quick question. Say a call a method like so mysql_pconnect(server,tator_w,password) or die(Unable
Just a quick question about how parameters are passed in Java... ... if ((index

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.