Most voted "list" questions
A list is an abstract type of data that represents a sequence of values, in which the same value can occur more than once. The main ways to implement a list is through an array (array, vector or one-dimensional matrix) or a chained list.
Learn more…1,022 questions
Sort by count of
-
2
votes2
answers9251
viewsHow to check a null position in the vector
Why do if(array[i] == null) is not correct? What would be the best way to check if that vector space is "empty"?
-
2
votes1
answer2622
viewsHow to group similar objects
I’ve hit my head and I couldn’t find the logic to do it. Well, I have a list of objects (Police): List and these objects have several properties, for example: organization, year, context and others.…
-
2
votes2
answers31
viewsHow to remove Level 1 keys using only one Callback method
I don’t want to use foreach and neither for. For example, I have the following array structure: Array ( [0] => Array ( [0] => Array ( [id_usuario] => 1 ) [1] => Array ( [idade] => 21…
-
2
votes1
answer866
viewsHow to access a list of another class in C#
I’m trying to access the Contact Contact List list in the Contacts List class to view. The problem is that although the list is filled in Contact, in Contacts Lists it appears empty. public class…
-
2
votes1
answer564
viewsComparison of Object Lists - C#
I need to compare 2 lists of objects that were populated via database, as classes below: public class Ausente { public ObjectId Id { get; set; } public Int32 RA { get; set; } } public class…
-
2
votes1
answer1348
viewsPass a List as parameter in Restful Java web services
Could someone explain to me how to receive a List as a parameter in a Restful Java webservices ? I’ve searched a lot of places, but I still can’t figure it out. Thank you in advance ! The code below…
-
2
votes3
answers1110
viewsMultidimensional array of different types
I have a view in my application database where I account for the user’s name, his sector and the total number of records issued (another table’s count): Table(View) Totalporusuario Columns:…
-
2
votes3
answers5527
viewsList in Python with non-repeated values without using set function?
How can I create a list from the sum of two previous without some value appearing repeated, without using the function set? Example: >>>a = [1, 2, 3] >>>b = [3, 4, 5] >>>c…
-
2
votes1
answer54
viewsDelete function from list
I have this function to delete from the list chained by value: public void deletar(Object valor) { Node temp = head; while(temp != null) { if(temp.getNext().getValor().equals(valor)) {…
-
2
votes1
answer880
viewsCreate a Python list copy so that they are independent
I have the following situation: I have the list 1 with the following values [10,20,30,40]. I want to create a copy of this list, but I need the list_2 not to change when I modify some value of the…
-
2
votes0
answers205
viewsList overwriting items
I have a Data Object List, which has two attributes: Name (String) and Transactylock (Int) It’s the Data List However, with each execution of the executarSchedule method, it overwrites the item…
-
2
votes1
answer116
viewslist.clear() vs list = new Arraylist<T>()
To remove all items from a list, I can do it in two ways: lista.clear() and lista = new ArrayList<T>(). What are the differences between them? In which situations should I use each one?…
-
2
votes1
answer8466
viewsFind item in a List with Contains method
I have a Data object, which has the attributes name(string) and transactBlock(int). I have a Data List called dataBlock. I want to see if this list has an item already with the same name and…
-
2
votes2
answers356
viewsMerge two items of an Ilist into one item by Id
In my class has: Id Venda Devolucao I have a IList of that class, and in that IList has [0] classe Id = 100, Venda = 230.00, Devolucao = 0; [1] classe Id = 100, Venda = 0, Devolucao = 50.00; [2]…
-
2
votes1
answer123
viewsCreate a list of ruby on Rails features
I’ve been trying for a few days but I haven’t been able to solve my problem. I need to create a list of features for an item and then list them all. I wish you could help me or give me some tutorial…
-
2
votes1
answer46
viewsComparing a data entry to a list, regardless of whether the word starts with a capital letter
I would like to know how to perform this comparison without taking into account if the month typed is capitalized or lowercase, since the program only works if you type in lowercase. prompt =…
-
2
votes1
answer77
viewsBasic doubt in Linkedlist - Java
If I have a Linkedlist called List that has size equal to 0, I can add an element at position 4 of it, for example?
-
2
votes3
answers1432
viewsPrint element from a specified position in the list
I need to get you to print the August days number on the list, but without using the: def how_many_days(month_number): """Returns the number of days in a month. WARNING: This function doesn't…
-
2
votes1
answer2251
viewsUse if/Else condition inside a while
Good morning!! I’m in need of some help. In the code below, I submit a file .txt delimited by ";". However, within the While, in the array, I would like to include a condition, example: while (…
-
2
votes1
answer635
viewsChained list within Chained list
I’m struggling with chained lists inside a chained list. The program is a card game in which there is a doubly chained list of players and within each node of that list, a list (the hand) of cards.…
-
2
votes2
answers2251
viewsChained list - remove function
I am programming a chained list without head, in this program there is a remove function that aims to eliminate all the repeated integers in a list, px: taking the values 8 2 8 3 the function has to…
-
2
votes1
answer363
viewsSave and load objects inside a list
Hello, can someone tell me why it is only loading value, and the key is blank/void? Code I use to save and load: public static List<Pair<String, String>> cash_player = new…
-
2
votes1
answer48
viewsWrite Dice from one list to another list
T = [0,0,0,1,0,0,0,-1,0] def acoes(T): listaAction=[] for i in T: if(T[i]==0): listaAction.append(T.index(i)) return listaAction print(acoes(T)) How do I write T-list indexes that have value 0 in…
-
2
votes2
answers535
viewsImport a list to another Form C#
I don’t know how to import a list to another form, if anyone can help me. The code of the first form is like this: Note that I want to Transport the ListaFornecedores to the Form FrmNovoProduto.…
-
2
votes2
answers222
viewsHow to show the Getall data I performed in an HTML table? MVC C# HTML
I’m running a simple site in mvc, by the college. I have to perform a crud. I created a getall method that lists all existing clients in a list. How can I pass the same to the view? I tried the line…
-
2
votes1
answer44
viewsConsole write 2 strings from the list
I created a list in which I added 2 strings: var lista = new List<string> {cliente.Nome, cliente.Sobrenome}; And in the end I wanted you to show it like this: Console.WriteLine(lista[0]); But…
-
2
votes1
answer102
views -
2
votes3
answers1084
viewslist value to a variable, Python
I want to create a list, and assign to a variable the value referring to the positioning of that list For example list = ["a", "b", "c"] Let’s say the priest gives me the letter "c" I want a…
-
2
votes1
answer382
viewsSort an integer Linkedlist without Sort method?
I want to know a simple method to order a Linkedlist! I’m breaking my head and searching the Internet, but I just find methods that already perform the work that I WOULD LIKE manually perform.…
-
2
votes1
answer194
viewsStore all types of variables in an array/array?
How can I store values and variables of all types within a vector? Ex: vetor1.Add("valor em string"); vetor1.Add(100); vetor1.Add(100.10); vetor1.Add(-100); I have no idea how I can do this.…
-
2
votes1
answer4081
viewsHow to break a list and turn it into an array in Python?
In case, I want to turn a list of a column into a 3x3 matrix in numerical order: lista =([[1], [2], [3], [4], [5], [6], [7], [8], [9]]) With the expected result: ([[7 8 9] [4 5 6] [1 2 3]])…
-
2
votes2
answers377
viewsList separated by "-"
The theme is as follows: I have a list[1,5,3,6,22,45,63,30,344,22,12,25,10] And I wanted to print the elements of that list in one line and separated by "-". I’ve tried that way…
-
2
votes1
answer216
viewsSingle lists with at least 2 difference elements
Considering the numbers: 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 How do I generate lists of 15 items (numbers cited above), and they need to have at least 2 items…
-
2
votes1
answer163
viewsHow to remove a specific character from some specific strings within a Python list?
I have a list of examples: ['#[Header]', '#Application Name\tLCsolution', '#Version\t1.24'] I would like to know how to remove a specific character, such as the # of all elements of the list, or, if…
-
2
votes5
answers7817
viewsSum of each element of two lists
Is there any code that sums the elements of two lists, for example: A=[1,2,3,4] B=[2,4,5,6] D=[3,6,8,10] # o elemento 3 e a soma dos elementos 1 e 2 da lista A e B
-
2
votes5
answers691
viewsMethod Reverse returns None
I’m applying the method reverse in a list and the same returns None. Ex. teste = ['audi', 'subaru', 'fiat', 'ford'] print(teste.reverse()) None…
-
2
votes1
answer200
viewsArray to Arraylist conversion difference with "asList" and constructor
What is the difference between these two ways of converting a array? If there is any difference, the same impact on performance? List<String> list = Arrays.asList(meuArray);…
-
2
votes2
answers186
viewsRemove item from a collection
Why is it considered incorrect to remove an object from a collection in this way? And why the exception launch ConcurrentModificationException? for(String item: list) { list.remove(item); }…
-
2
votes2
answers1014
viewsFind the maximum and minimum number in a list in a string
I have the following file: a = '1 0 10 2 3' I want to print the highest value and the lowest, so I used the max() and min() but it only counts the unit. I did it this way: a='joao 1 0 10 2 3'…
-
2
votes1
answer403
viewsAsync method returning a List<string> how to use?
I have a method called consulta_usuario_email, that is responsible for searching in the table of registered users, the emails of users of a certain department: public async…
-
2
votes1
answer4177
viewsHow to create a list and put other lists inside?
def annexsentence(): nome_tarefa=input("Nome da Tarefa :") data_atual = datetime.datetime.now().strftime("%d-%m-%y") data_final=input("Data Final :") estado="Aberta"…
-
2
votes1
answer91
viewsLinked List - append and push
I’m trying to learn Linked List and I made the following code: #include <iostream> using namespace std; typedef struct snode { int data; snode *next; } node; void start(node ** head) {…
-
2
votes2
answers3679
viewsHow can I add a character to each element of a Python string?
We have the following list: list=["oi","meu","nome","é","Gustavo"] I want to add a character at the beginning of each element of the list (added the name opa in each element manually same :p):…
-
2
votes1
answer999
viewsHow to search for an element in a structure vector?
Good night! I am doing a work in C where I have to look for doctors by specialty, that is, I ask the user the name of the specialty to look for and I make a printf of the doctors of that specialty.…
-
2
votes1
answer3640
viewsHow to check if there is an element in a Python list?
I’m trying to do an algorithm in Python to check if there’s an element in a certain list. If yes, the program will print on the screen, if not, it will add a new element in the list. My intention is…
-
2
votes2
answers1639
viewsHow to Instantiate an Object in C#
How do I instantiate an Object in another class? I’m trying this way: GameObject Cozinha = new GameObject("CenaCozinha"); CenaCozinha coz = Cozinha.AddComponent<CenaCozinha>(); But I believe…
-
2
votes1
answer62
viewsPrint a list according to the number of labels
My C# Console Application has a list of 7 items in all, and you need to print these items on a label. By default each label fits 5 items. I’m not able to print the items according to the amount of…
-
2
votes1
answer172
viewsLoop Replace all string characters by python list character
What I want to do is take a string and for each character of the string walk type 3 positions back in the alphabet and replace in the string or create a new string Ex string = 'abcd' walking 3…
-
2
votes2
answers130
viewsCheck if there are different elements in a list in R
I have a list that each element is one data frame containing various information on a particular pension institution. In the column CLASSE there can only be one type and I need to know who owns more…
-
2
votes2
answers409
viewsHow does Python keep the same memory reference as a list after resizing it?
We know the objects of the type list, because they are based on dynamic vectors, it has a maximum internal capacity. We also know that when this total capacity is reached and we want to insert a new…