从Java中的对象数组中检索分配给特定类成员的值的数组 [英] Retrieve an array of values assigned to a particular class member from an array of objects in java
本文介绍了从Java中的对象数组中检索分配给特定类成员的值的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
比方说,我有一组复杂的数据类型对象.例如:FullName[100]
.每个FullName
对象都有2个类成员变量:String FirstName
和String LastName
.现在,从这个FullName
对象数组中,我想检索一个String FirstNames[]
数组.
Let's say, I have an array of complex data type objects. For example: FullName[100]
. Each FullName
object has has 2 class member variables: String FirstName
and String LastName
. Now, from this array of FullName
objects, I want to retrieve an array of String FirstNames[]
.
如果没有广泛的for循环应用程序,该怎么办?
How can I do this without the extensive for loop application?
推荐答案
您可以尝试看看使用Java进行功能编程,并从其中一个库中应用map
函数.
You can try to take a look at Functional Programming in Java and apply map
function from one of the libraries.
这篇关于从Java中的对象数组中检索分配给特定类成员的值的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文