Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lookup Tables in Java?

In my Computer Science course, we're learning about Lookup Tables. But our teacher did not provide any examples in the lesson pages he has posted, nor the videos he provided. All he did was tell us what it was but he wants us to use them in our next assignment. But he has failed to give us examples of how to do it. We were learning about Arrays before we got into Lookup Tables. Can someone

  1. Tell me what a Lookup Table is? (Lots of details please?)
  2. Provide some examples of a Lookup Table? We're supposed to use Arrays?
like image 532
Garrett Outlaw Avatar asked Feb 27 '13 14:02

Garrett Outlaw


People also ask

What is a lookup table in Java?

A lookup table contains data arrays for one or more bands (or components) of an image (for example, separate arrays for R, G, and B), and it contains an offset which will be subtracted from the input values before indexing into the arrays.

What is lookup table with example?

In data analysis applications, such as image processing, a lookup table (LUT) is used to transform the input data into a more desirable output format. For example, a grayscale picture of the planet Saturn will be transformed into a color image to emphasize the differences in its rings.

What is meant by lookup table?

A lookup table is an array of data that maps input values to output values, thereby approximating a mathematical function. Given a set of input values, a lookup operation retrieves the corresponding output values from the table.

How do I find lookup tables?

Lookup tables must be text files with two columns and use commas, equals signs ( = ), or tabs as a delimiter. The key column is always the first column from the left, and the value column is the second column.


1 Answers

You can use a map to store key/value pairs and lookup a value by it's key:

Map<Integer, String> map = new HashMap<>();
map.put(1, "Foo");
map.put(2, "Bar");
System.out.println(map.get(1)); // prints Foo
like image 102
jlordo Avatar answered Sep 24 '22 19:09

jlordo