Questions tagged as 'lista'

1
answer

What is the difference between Arrays.asList and List.of?

Studying Java 9, I saw a new method that works with collections: List.of , example: List<String> frutas = List.of("maça", "laranja"); I already used Arrays.asList , for example: List<String> frutas = Arrays.asList(...
asked by 06.10.2017 / 14:46
1
answer

Order By with List

Is it possible to make a OrderBy in a List<> setting the value for comparison? Example: mRel.OrderBy(s => s.Status == EnumModel.StatusGeral.Novo).ToList() My Code: List<MotivosModel.MotivosRel> mRel = Carre...
asked by 04.05.2017 / 17:43
1
answer

Which sort algorithm does .NET use by default in a list?

I have a problem that I have to perform memory sorting on a large number of items and would like to know which algorithm .NET uses to sort when we call the Sort() method of a list, for example. I need to know because I realized that my...
asked by 11.10.2017 / 17:00
2
answers

How to create and manipulate lists in PHP?

In java it is possible to create and manipulate list of any data type using List<E> , see the example below: List<String> lista = new ArrayList<>(); lista.add("Stack"); lista.add("Over"); lista.add("flow"); I created...
asked by 06.10.2016 / 15:21
5
answers

Create objects within a List without for / foreach C #

private List<Compra> CriarCompras(int numComprasParaGerar) { List<Compra> lstCompras = new List<Compra>(); for (int i = 0; i < numComprasParaGerar; i++) lstCompras.Add(new Compra()); return lstCompras; }...
asked by 29.09.2015 / 14:43
2
answers

Convert a collection of type Set to List

I have a class that has an attribute of type Set, because I want repeated values to be ignored, however I need to return this in List form to fill in a ListView , so what is the best way to implement this feature? Reader.java packag...
asked by 12.08.2015 / 19:52
2
answers

What is the purpose of the operator = in the use of lists?

What is the purpose of the => operator in the use of List<T> lists, I'm starting to use generic lists and I came across this operator, it is only used in this method LISTA.ForEach(i => Console.WriteLine(i)); ? Below...
asked by 20.11.2015 / 01:23
1
answer

How do I make the JTable values the same as the ArrayListPessoa?

I have an example program that adds objects of the type of my class Pessoa to a JTable and also to ArrayList<T> , this program has three basic functionalities which are as follows: Add Change Delete See the pr...
asked by 18.10.2016 / 23:25
2
answers

How to capture the last element of a list in Python?

In PHP, to get the last element of an array I can do this: $array = array(1, 2, 3); echo end($array); // 3; What about Python? How could I do this with this list: arr = [1, 2, 3]     
asked by 09.01.2017 / 19:28
2
answers

Count the number of occurrences of a value in a list

I have list with the following values: numeros = [5, 3, 1, 2, 3, 4, 5, 5, 5] In Python would have some function to count how many times some value repeats? For example: I want to know how many times 5 has repeated.     
asked by 09.01.2017 / 20:04