What are the applications of day-to-day arrays? (examples of their usability)

Asked

Viewed 554 times

0

I did a search on the internet about the use of arrays and found many results aimed at creating games just... But aside from this example, where I use more arrays (matrices) in everyday life (application development for example)?

I have this doubt because the booklet used in my Java discipline in college briefly addresses the arrays and questioning my teacher about the reason he told me that it is not very usual this structure in everyday life ("is not the focus of java" and you will see why when we study databases")...

But the curiosity was still.

2 answers

6

Arrays are widely used in the Java language. Inclusive Strings are implemented by means of arrays. There are several methods in JDK in several classes that create or consume arrays of various types.

However, it is true that working directly with arrays has its drawbacks there. It is often a good idea to use more flexible abstractions such as ArrayList (using an array internally).

  • So you and @Maniero stated that arraylist faz uso de array internamente I was surprised and went to see the source code. It never occurred to me that arraylist used a finite, limited, and common array to store elements, even though it was such a robust, flexible class.

  • 3

    @Articuno When it pops up, it creates a new larger array, copies the elements and discards the old array.

  • 1

    The class name indicates this: I am a list, but underneath it has an array

5

Well, actually there’s practically no application other than trivial demonstration that doesn’t use array extensively. Then all applications make use of array.

Although in some cases the array not be used directly, but within a structure with a similar function with slightly different commitments. It may be that the teacher was talking about it. Own string is a array characters. The ArrayList is another widely used and often preferred type compared to array pure, but inside there’s a array, and this guy is still a array, only that it allows the convenience of increasing its size when it needs.

Most Java methods return a array as a result of your operation. Of course many also receive a array. And I’m talking about array even.

What is a array has already been answered. Summarizing is a way to have several variables with one name, all arranged in sequence and being accessed by an index, so there is a general name and an index of which element you are referring to.

One of the biggest advantages of a computer is to quickly compute large volumes of data. It is almost impossible to have large volumes of data other than a sequence of similar data.

Every time it is possible to have some data of the same type with the same feature fits a array.

Then you can have a list of clients, of points, of any values, of temperatures, of files, of various words, of windows, Urls, of soldiers, finally, of any object.

A database table is much like a array 2-dimensional. You have columns that by themselves are still a sequence of data and have rows with each entry in the table. But it is more common to have an object that simulates the columns and the array would be equivalent to lines.

From the array it is possible to create several sequence data structures.

In general, links are used to access and manipulate the elements of arrays.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.