genéricos

Why use a generic return?

Was looking at the signature of the class methods Optional and I didn't understand what this <T> means in front of the ... t; Optional<T> empty() It returns a Optional<T>, right!? But why use a <T> in front of the method return?

Generic and Comparable in Java

I have a question that I cannot see answered, If anyone can give me a plausible explanation I will be grateful. Assuming I h ... since one element is inherited from the other and soon also inherits the interface comparable figure? Thank you right now.

Why are arrays Covariant and generic are invariant?

Arrays in Java are covariants, that is, it is perfectly cool to do something like: Number[] meuArray = new Integer[10]; A ... id you decide to implement Covariant arrays? Original question: SOen-Why are arrays covariant but generics are invariant?

How to assemble a lambda expression and pass it by parameter to a generic function?

I need to pass two parameters to a generic function that returns database data and select only a few specific columns to disp ... (parameter passing): dgPesquisar.DataSource = UsuarioRepositorio.GetAll(null, u => u.login, u.Senha, u.NOmeCompleto );

Can anyone explain to me what is a generic Moon tie?

I already know the ties while,repeat and for, but when I was looking at the types of loops, in the section I found the SUCH of the" generic for Loop". The text was in English.

Parametric polymorphism and overhead in Java and C++

The following question fell in the ifsp contest: In Java and C++ programming languages, the parametric polymorphism is ... How to define parametric polymorphism in Java? Be generics ? In this case, could we translate the word and say it's generic?

What is Monomorphization?

I was reading this post and came across this term monomorphization I would like to know: What is its meaning? when does this process occur? What performance gain/loss is achieved by this process?

How can I pass a parameter, of any type, to a generic vector? - C

I have a structure of type TTabelaX, which is basically a table that I will store elements of any type, that is, I can create ... = 0; return aux; } void inserir(TTabelaX* aux, ???){//<--como passar um parâmetro sem saber seu tipo? ... }

Is it possible to create a Java superclass for basic CRUD functions using spring framework?

When working recently on a project, I noticed that we have several classes with basic CRUD functions and that repeat themselv ... return clienteDAO.findAll(); } public Cliente buscarPorId(String id){ return clienteDAO.findById(id).orElse(null); } }

Difference between using generics and" any " in TypeScript?

When I know it is preferable to use generics or any in TypeScript?

Dynamic declaration in attribute property

As part of an ORM microplatform I'm developing, I'm defining a generic class that exclusively implements tight coupling (1 re ... ty<Course> { [...] However the use of new() is not allowed. Which model would better serve this type of behavior?