Java list which clones elements when added

Is there a Java class which implements the List interface and which clones elements when they are added to the list? The goal of this would be to preserve encapsulation of this list as an object. O

View details »

How to change the date format of List<Date>

I have a List and when i print its content i get the Dates in specific format. Lets say that i want to get them in a different format, how do i get to choose the format that i want the list to be pr

View details »

How to sort SplDoublyLinkedList?

There is a linked list that needs to be sorted in O(n Log n) time. I would like to use merge sort, but I can't figure out how to implement it by extending the SplDoublyLinkedList class. The main

View details »

Sorting dictionary to list of keys by value and then by key

I have this dictionary: dictionary = { 'd': [2, ''], 'b': [4, ''], 'a': [4, ''], 'c': [7, ''] } I want output sort

View details »

How to create an ArrayList of Text Files in Java?

I'm trying to create an ArrayList of pre-existing text files (basically take a folder of text files that are already saved on my computer and plug them into an ArrayList) so that I can iterate over

View details »

Delete singly-linked list with struct elements

I currently am stuck with a task on my current assignment and I have no clue, why it does what it does, instead of what I want. First of all, here's the assignment: Provided is a singly linked lis

View details »

How can I create a ListView in JavaFX from an ArrayList of type Object?

I’m trying to create a March Madness 2019 bracket generator in Java. I initially created two classes, MarchMadness and Team, but now I’m trying to create a GUI for the program. I created a new

View details »

Splitting groups of doubles into elements in an ArrayList (JAVA) [duplicate]

I'm adding three different objects to an ArrayList, but the list contains three copies of the last object I added. For example: for (Foo f : list) { System.out.println(f.getValue()); } Ex

View details »

MATRIX: is not showing the correct result

I am doing a code to determine wich is the smaller age and greater age. people = list() data = list() old = new = 0 while True: data.append(str(input('Name: '))) data.append(int(input('Age:

View details »

I don't know why original list changes when alias of list is changed

lCopy is an alias of the original list l. When lCopy is changed, l also changes. I don't know why this is happening. def organizingContainers(l): ball = 0 def checkContainers(ball,lCopy):

View details »

Search a 2 dimensional list for a string in another list

I want to check if a value in one list is in a second list. The second list is a 2 dimensional list defined in a class. Here's some sample data. tagNoMatchList[0] = "</Configuration>" tagNoMatchL

View details »

How to order a list in sublists in Lisp?

I have a list like this: (4 5 6 3 12 22 4 4 55 43 1 4 0) and want an output like this → ((4 5 6) (3) (12 22) (4) (4 55 43) (1 4) (0)) I think you can guess the order, it has an ascending order, I'm totally new with Lisp and need some help

View details »

Iterating over list, reusing certain values several time in csv

I have some data looking like this: description "export" source "factory1" source "factory2" source "factory3" destination "customer1" destination "customer2" shipdate "asap" description "export"

View details »

R - Use an outlier function on a list of dataframes

I've made a function and would like to apply it to a list of dataframes. So far unsuccessfully. Is this a job for lapply, or sapply? # Remove outliers outlier <- function(x) { x[x < quantile(x,0.

View details »

How to print only the second element of the sorted array?

Here i have sorted the array in ascending order.Now i want to only print the second element of the sorted array. Below code prints the second element of the unsorted array. What can I do? #includ

View details »

How can I transform it in a list of tuples key-value again?

I want to transform it: [('user1', 10),('user2',2),('user2',24),('user1',10),('user3',15),('user3',8)] to it: [('user2', 0.52), ('user3', 0.46), ('user1', 0.4)] I need to add the values, grou

View details »

Auto-Populating to create 1 list in 1 column based on data from two different columns

Having some trouble with a very simple problem. I want to create 1 list in a column based on data from two different columns, I only want each item to appear once in the list column. So to create

View details »

FlatList renderItem error, TypeError: undefined (evaluating 'item.id')

I have a FlatList where I put some data in from my database. In the render method, the state.data is correctly displayed when I console.log it. But in the renderItem method I try to print the item o

View details »

code error in word2vec program for DNA sequence

I have been trying to develop a code to read nucleotide in fasta format as strings(each input as one word) and then use already known binding site sequences(11 bp long) to search amongst the nucleo

View details »

Lambda for List in Object

I have an object called UserSettings which contains a list of another object called SettingsFolder. This object in-turn has a List of SettingsFolders. The idea is to mimic a user that has a set of f

View details »