Category "collections"

Task1:Search for people with their social security number. Task 2: Fetch the list of residents based on their gender

I've created an ArrayList of Residents. Each Residents consists of full name, ssn number and gender. I had to sort the elements by ssn number first and then by

Autmapper map collections of different types to collection of another type with nesting

I am currently struggling with automapper.10.1.1 config. I have following types: class Response { List<Assignment> Assignments { get; } List<Pr

Why should I avoid using the increase assignment operator (+=) to create a collection

The increase assignment operator (+=) is often used in [PowerShell] questions and answers at the StackOverflow site to construct a collection objects, e.g.: $C

hashCode values not same in debugger and output in netbeans 8.2

Map<String, Integer> map = new HashMap<>(); map.put("Naveen", 100); System.out.println("Naveen".hashCode()); /* output (-1968696341)

Can ReSharper generate equality members that correctly compare Collection members?

Say you have a class with members that are collections, such as. public class Forest { public IImmutableList<Tree> Trees { get; } . . . } When

Magento 2 product collection sorting is not working (I am doing with custom attribute)

This is my code $_productCollection = $block->getLoadedProductCollection()->addAttributeToSort('article_position', 'DESC'); echo '<pre>'; print_r(

Odd number Sequence Replaced by Count

I am working on java Program here is program Question: Consider Java Program. It reads integers from the standard input (until it gets a negative number) and

Trying to find "magic combinations" in MongoDB

I have two MongoDB collections in a database named "records". Here's a sample document from the first collection: course_completions { "_id" : NumberInt(1

How to convert a carbon into string, to take the date only?

i have an collection like this 0 => array:4 [ "so" => "SO-1" "product_name" => "EXTREME FORTE - BP" "created_at" => Carbon @1527481346 {#628

Custom sort order on a Spark dataframe/dataset

I have a web service built around Spark that, based on a JSON request, builds a series of dataframe/dataset operations. These operations involve multiple joins,

Find an object with certain private value in a java Collection

I am currently coding a game that uses an 8x8 grid. I have to stock a domino (2x1 size) in the grid for every player but when a player wants to add a Domino to

How to add an entry with an Integer value into Map<String, ?>

I have to place an integer value into the map below. Map<String,?> map map.put("key",2000); When I run the above code I'm getting the following error: in

How to skip an item in nested map based on When()

I want iterate over items's data and create a a new list of SomeData based on item.type however when type is UNKNOWN I need skip that element and not add to lis

Why do I need Comparable for PriorityQueue?

I'm learning about Queue Collection and I don't understand why do I need to implement Comparable interface if I use PriorityQueue? I have used Comparable and Co

How to remove an element from a Set inside a Page of items based on a Condition using Java 8

I have a Page of Farmers coming from a JPA repository call findAll method. Each Farmer consists of a Set of Farms which are also coming in the repository call l

Get Only Values from a Map to an array

I want to get values of a map and store inside a string array in typescript. myMap= [0:'Mohit',1:'Balesh',2:'Jatin']; arr[]; Expected Result arr['Mohit','Bal

Java collection like c# KeyedColllection<TKey,TItem>

Is there a Java collection that has the same behavior as the c# abstract KeyedCollection class (that is items can be retrieved by both key and index)? I have l

java.lang.NoClassDefFoundError: org/springframework/util/MultiValueMap

I am using Spring-core 3.2 jar but I am getting error as "java.lang.NoClassDefFoundError: org/springframework/util/MultiValueMap". MultiValueMap<

How to pretty print a complex Java object (e.g. with fields that are collections of objects)? [closed]

I'm looking for a library function (ideally from a commonly used framework e.g. Spring, Guava, Apache Commons etc.) that will nicely print the

How to add items to a list of lists

I aim to print a list of lists containing entry and exit times in the 24 hour decimal format from the "AM"-"PM" String format input by the user as a String arra