Questions tagged as 'collection'

2
answers

Why does not polymorphism work with Generics?

When trying to compile the following code I got an error. import java.util.*; class Animal { } class Cachorro extends Animal { } public class TestePoli { public static void main(String[] args) { List<Animal> cachorros = new A...
asked by 10.03.2014 / 00:06
3
answers

How to add dynamically in ul with jQuery?

I'm bringing backend notifications and I need to dynamically add the path to them, how do I add a <li> to each response element? JavaScript $(document).ready(function () { $.ajax({ url: "/tasks/not-assign", dataType:...
asked by 20.09.2016 / 13:21
2
answers

In which scenario is it recommended to use KeyedCollection instead of a Dictionary?

I did not know of the existence of KeyedCollection until you see this #
asked by 27.03.2015 / 11:58
4
answers

Doubt about exercise with abstract class in Java

I would like to ask for your help again in this exercise. This time using the abstract class.    Create an abstract class FuncionarioAbstract with the String name attribute and the abstract method: public double getSalario();...
asked by 17.11.2016 / 14:58
3
answers

How to set the equality comparison between two objects present in an ArrayList?

How can I set the equality comparison behavior between two objects whose class is defined by me that are stored in an object of type ArrayList? ColorName public class NomeCor { private String nome; public String obterNome() { return no...
asked by 03.04.2017 / 02:55
1
answer

Sorting HashMap by value and assigning a value using java 8

I currently have the following functional scenario: A list of the Studios class with id and name: List<Studios> studios; I count repeated names in List as follows: Map<String, Integer> counts = new HashMap<...
asked by 21.09.2018 / 14:41
1
answer

Arraylist of int [] in java

I am creating a list from a array using the Arrays.asList method. Now I want to remove the first element, but Java accuses:    Exception in thread "main" java.lang.UnsupportedOperationException List<Integer> lista =...
asked by 17.07.2017 / 22:22
1
answer

What is the Scala Collection equivalent to ConcurrentHashMap?

Hello, how can I implement a ConcurrentHashMap in Scala?     
asked by 02.06.2015 / 22:05
1
answer

How to alphabetically and numerically sort the same list?

In my college work I should make a list of the type of a class I have created and should sort it in two different ways, one in alphabetical order and one in average. Also other information is that alphabetic ordering should not be standard, but...
asked by 20.04.2015 / 03:27
5
answers

Get object in array by description in index

Is it possible to use the property of an object as an index of an array , as described in the example below? using System; public class Program { public static void Main() { var myObjectArray = new MyObject[]{ new...
asked by 24.11.2017 / 12:53