-8
我有一个对象,它又包含其他对象。现在,我必须遍历这个主对象,然后选择每个对象,然后遍历它们以查明它们中是否存在任何空字段。如果对象本身是空的,我必须将它从主对象中剪除。对此有任何想法请。循环遍历java中的对象
public class Transactions {
private Integer totalTransactionCount = null;
private List<Transaction> transactionsList = new ArrayList<Transaction>();
}
public class Transaction {
private String amount = null;
private Foreign foreign = null;
}
public class Foreign {
private String amount = null;
private String commissionAmount = null;
private String exchangeRate = null;
}
现在我这里有一个交易对象,我要循环throught它的每一个领域,并通过各自的领域依次循环,找出任何空/空字段。
这是非常基本的编程,你应该阅读一些教程。 – abbath
请提供样本代码 – Nyakiba
也这种需求听起来很混乱。你能更具体地了解你的任务吗? –