Questions tagged [collections]

Collections APIs provide developers with a set of classes and interfaces that make it easier to handle collections of objects.

0
votes
0answers
2 views

Multidimensional Data Input

I am currently stuck on how to implement a procedure to get and store information in VBA. Objective: To get a list of agents to assign a task(s) to. Get a list of tasks(ticket number) for each ...
0
votes
0answers
2 views

Meteor.JS - Yogiben Favourites - How Can I Show Title?

I'm building a small app within meteor, using the yogiben favourites package to allow users to favourite select items in a collection. Currently the below code only shows the ID of the favourite/post,...
-1
votes
3answers
48 views

How to check if Object inside List of List is empty or null

I have something like List<List<UsersDetails>> userList, if I debug to see its value it's giving [[]] i.e., List<UsersDetails> is empty and List<List<UsersDetails>> is ...
0
votes
1answer
28 views

Angular - How to access Map<K, V> values in DTO from JSON?

I have got 3 DTO-s inside eachother like this: export class firstDTO { public data: secondDTO; } export class secondDTO{ public data: Map<Color, thirdDTO>; } After I receive the JSON ...
0
votes
1answer
19 views

How do I add controls to my UserControl when I edit its Collection of controls?

I am using C# in Windows Forms to create a UserControl. It's my first .NET UserControl, but I have created many custom components in Delphi in the past, so it's not a totally unfamiliar concept. My ...
-2
votes
0answers
21 views

Difference in internal working of HashMap and LinkedHashMap? [duplicate]

I could not find any difference in internal working of HashMap and LinkedHashMap, really helpful if someone can help me with this.
0
votes
0answers
14 views

OneToMany Doctrine Column With Collection FormType

I have a CollectionType that I'm trying to use to insert several strings into an entity MotorsAdsFile (The image entity) and have them related to the current entity through it's id. I use Blueimp and ...
-1
votes
0answers
14 views

VB.Net- Retrieve data from a collection of a another form - Syteline ERP

I am using syteline ERP system. The forms are scripted using VB.Net I am trying to retrieve data from a another collection comparing two other fields from the present collection and the collection ...
5
votes
4answers
109 views

How to check if an ArrayList of Strings contains substrings of another ArrayList of Strings?

List<String> actualList = Arrays.asList ("mother has chocolate", "father has dog"); List<String> expectedList = Arrays.asList ("mother", "father", "son", "daughter"); Is there a way to ...
-1
votes
0answers
26 views

How can I implement Collection/List interface or abstract class in Kotlin?

I'm having trouble implementing the iterator and get set functions. (Edit: By trouble I mean that I don't know how to do it and I need help) In the past, I've inherited from ArrayList even though I ...
0
votes
3answers
31 views

How to update token when the user logs in in express js?

I want to update token in user collection when the user logs in. So far, I have tried this. router.post("/login", (req, res, next) => { User.find({ email: req.body.email }) .exec() .then(...
1
vote
3answers
28 views

Update a single key value in a Laravel Illuminate collection

I am building a collection from a Facebook API response. $ads = new \Illuminate\Support\Collection; if (!$ads->has($insight[$key])) { $ads->put($insight[$key], [ 'ad_id' ...
-1
votes
0answers
38 views

How to merge two List<bean> into single List<bean> - Java Spring Data Jpa

I am working on spring Data there I am getting two List. Now I want to merge those list into such a way that final list will contain only unique ids and all the duplicate data against same id will be ...
-4
votes
2answers
39 views

How to simulteniously delete elements from two Arraylists based one same index value in java

I have two arraylists which contains two set of strings.For example List domainList contain {'gmail','yahoo','yahoo','aol'}, and list flagList contains {'Y,'N','N','Y'} .So now since yahoo is twice in ...
-1
votes
1answer
36 views

How do I create a new collection in VBS? [duplicate]

I am trying to create an empty collection in VBS for xDX Designer. How do I create a collection object from scratch? I'm not interested in a dictionary, which is what I'm seeing others suggesting ...
5
votes
4answers
76 views

Maximum of list with expensive custom key function

In Java to find the maximum element of a sequence you write: GameState bestGs = Collections.max(ns, Comparator.comparing(e -> minimax(e))); Here minimax is a function returning a number ...
0
votes
0answers
22 views

Split Model data into Two models which is received via parameter [on hold]

I am receiving some values in one of my function mentioned below. I am receiving it in form of list of a model. I have to save that data into two different models. So i thought to split the data in ...
5
votes
2answers
64 views

What makes Hashmap.putIfAbsent faster than containsKey followed by put?

Question How is the HashMap method putIfAbsent able to perform a put conditionally in a way thats faster than calling containsKey(x) prior? For example, if you didn't use putIfAbsent you could use: ...
0
votes
0answers
31 views

Are there in Java thread-safe queues other than BlockingQueue?

From docs: Note that a BlockingQueue can safely be used with multiple producers and multiple consumers. So BlockingQueue is about producers / consumers problem solving at first place, but I need ...
-1
votes
1answer
41 views

Java 8 - How to search a MultiValueMap with value? [duplicate]

I have a MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); The type of value is a list of strings: List<String> valueList = map.get('key'); How can i search ...
-2
votes
0answers
32 views

How should i store and print number of times(frequency of occurence) a rfid card detected? [on hold]

I coded a java program which detects rfid cards. I used thread to continuously run the program and print the rfid card value. But i want to print the detected card value only once and print only the ...
0
votes
0answers
37 views

Symfony 4 nested collection by_reference not working

I've an issue with a complex form It's a templater wich describes a film (scenes, elements, conditions, ...) It look like this : Inside the elements collection I have a nested collection options : ...
0
votes
3answers
32 views

How do I only read n lines at a time and print in reverse java

My objective is to only read 50 lines at a time from a text file, print them in reverse order and only store 50 lines a time in memory. In the most efficient way possible. This is the code I have ...
0
votes
0answers
45 views

To print elements using nested tables in oracle

I am working on a procedure which has two parameters with collection type. Sample data: accounts accountid 2 3 4 rts_accounts ...
1
vote
1answer
18 views

Check_box_tag input id

I have a check_box_tag that looks like this : check_box_tag('shipping_method[shipping_categories][]', category.id, @shipping_method.shipping_categories.include?(category)) When inspecting the ...
0
votes
3answers
23 views

Model.find is not a function in mongoose

I am new in node and mongodb. I am trying to query a different model(Event) from another model(Company). Basically in Event model there is a field called company. I would like to get the company ...
-2
votes
3answers
52 views

Return user Highest number and Unique number in table [on hold]

I has table user_data: I want return user has Highest number and Unique number! => User id=5, name= E, number=3 Thanks!
0
votes
1answer
24 views

Dinamic parsing variables to array_map

I have this function public function saveVariantValue($id, $data, $langs, $field, $client) { $transformation = []; $parts1 = explode(';', $data[$field][1]); $parts2 = ...
0
votes
1answer
25 views

Immutable Insert alternative

I'm looking for an immutable alternative for the standard Collection<T>.Insert(Int32, T) method. In my specific case I have a method like this: IEnumerable<int> Foo(IEnumerable<int>...
2
votes
1answer
35 views

UnsupportedOperationException while iterating over CopyOnWriteArrayList

I came across the following statement in a book: Any mutating methods called on a copy-on-write-based Iterator or ListIterator (such as add, set or remove) will throw an ...
0
votes
1answer
53 views

How to calculate rolling statistics in Scala

I have knowledge with respect to handling Dataframes in Python but I am facing the below problem while writing in scala. case class Transaction( transactionId: String, accountId: String, ...
0
votes
1answer
38 views

The specified value is out of range

I am trying to display slide no. in immediate window if they even one text box with a red font word. But the following error keeps popping up. Any ideas how I can go ahead. Run-time error'-2147024809(...
2
votes
1answer
53 views

Changing values in Set<?>

I have a set containing Item objects: Set<Item> The class Item has a method getName() that returns a string. I want to convert Set<Item> to Set<String> using the method Item#getName(...
0
votes
0answers
6 views

How to prevent markers from repeating in clustermanager android?

I'm using geofire library to load data from firebase 3 in a specifique region, but when i add new marker to database and i check my map i found out that multiple marker has been added in the same ...
-2
votes
1answer
34 views

what is the most efficient way of getting objects from list based on field of class

I have an ArrayList of type Customer which contains fields suhc as id, name and age. Currently, to find a customer with a given id, I am looping through the entire list and using getID. However, this ...
2
votes
0answers
18 views

How to prevent marker from repeating in clustermanager?

I'm using geofire library to load data from firebase 3 in a specifique region, but when i add new marker to database and i check my map i found out that multiple marker has been added in the same ...
1
vote
3answers
55 views

finding all possible time combinations between a given time range

I need to find unique digits present within all possible combinations of time (hh:mm:ss) between 2 specific times for ex 12:09:47 to 14:20:55. I'm currently I am doing the following: Getting the ...
-3
votes
2answers
40 views

Need to put one custom hashmap into another hashmap

I have below maps: HashMap<Integer, HashMap<Integer, Employee>> hmap = new HashMap<Integer,HashMap<Integer, Employee>>(); HashMap<Integer, Employee> emap = new HashMap&...
2
votes
2answers
53 views

Why don't I see all variables in debugger?

Hi all! I tried to debug TreeSet<String>/TreeMap<String> but found that debugger for some reason doesn't want to show me parent and left/right children of the nodes. I expected to see ...
1
vote
2answers
49 views

How to fetch data from mongo db using get method in express js?

I have created two collections bear and bears in mongo db. I have defined bear collection in express code but it is accessing bears data. I am very confused now. (bear and bears have the same field(...
0
votes
0answers
26 views

How to parse the JSON returned by a REST API call into a collection of objects in JAX-RS?

I am fairly new to JAX-RS so bear with me on this question. I'm trying to consume a REST API using JAX-RS framework. In particular I am trying to invoke a HTTP GET method on a resource where the ...
0
votes
0answers
17 views

How to use a collection show in the console. [Discord JS]

Hey guys i have a question. I am using var data = msg.channel.fetchMessages(492058183091617803); to get all recent messages said in a certain channel. In this case i am just fetching 1 message. ...
0
votes
2answers
50 views

Efficiently iterate and mutate an association

We have code that is effectively doing this. obj.things.each |thing| ... do some stuff ... obj.things.destroy(thing) ... do some more stuff... end We found out that simultaneously ...
0
votes
1answer
88 views

Java 8 stream, How to chain mutliple operation on a collection? [closed]

I have a set of libraries populate by sql. Each of them owns books are referenced with as properties a publisher, a title and an author. The book thus referenced is available in quantity. I want now ...
-1
votes
0answers
30 views

Multiple Overriden “of” method Java.util.List [duplicate]

Just out of curiosity. Does anybody know why there are so many overriden Of method in java.util.List ie. accepting 1 param, 2 params.... 9 params and finally accepting var args? To me, it Looks like ...
1
vote
2answers
31 views

Laravel: Access collection in view

I would like to display users that have sent or got message/s. User Model: public function messages_sender() { return $this->hasMany('App\Message', 'sender_id'); } public function ...
0
votes
0answers
19 views

Define type of parameter in method in Laravel as a Collection of Model

In a Laravel 5 class, I want to properly type-hint a method which receives as parameter a collection of classA items. public function myMethod( Collection<ClassA> $items ){ foreach( $items ...
0
votes
0answers
29 views

ResponseEntity returns result sorted in ascending order java

I am wokring on collections here is my code List<myEntity> myData = new ArrayList<>(); Map<Integer,List<myEntity>> myid = new LinkedHashMap<>(); try { myData = ...
3
votes
1answer
51 views

I thought “NlogN” is “N” times “logN”, but why is it described as “double PLUS an amount proportional to N”

I'm currently learning about the big O notation. In the material, O(NlogN) was described as Doubled plus an amount proportional to N. But I thought that would be O(N + logN) and not O(NlogN) (I ...
1
vote
0answers
52 views

Java8 streams : Filter data from two list of command object. Is there any other efficient way of what i am doing?

I have two lists that hold WorkflowCommands and WorkflowInstanceCommands. public List<WorkflowCommand> workflowList = new ArrayList<>(); public List<WorkflowInstanceCommand> ...