java - How do I use on method to get the sizes of two different-sized arrayslists?
问题描述
I'm new to Java and I want to use one method, getCount, to get the sizes of two arraylists that are not the same size. What code could I use so that I can call, for example, examp1.getCount and examp2.getCount, and get the two different sizes?
解决方案
This is frankly as basic a question as it gets, and google could have helped you with this easily. Here's your entire method if you want to design your own.
public static int getCount(ArrayList A){
return A.size();
}
推荐阅读
- pip - uwsgi安装在centos7中被杀死
- php - Laravel 6.0 - 自定义电子邮件验证:temporarySignedRoute() URL 不适用于新路由
- jakarta-ee - Bean Validation API 中 javax.validation.Payload 的用例是什么?
- sql - 获取特定用户组的下一个购买日期
- c - struct 中的指针放在两个 struct 成员上
- scala - 使用 Spark 高阶函数时如何返回案例类?
- java - 在 Java 中获取支持的 CPU 功能/指令
- amazon-web-services - AWS SNS 文本消息 (SMS) 无法发送消息
- javascript - 使用 setInterval 循环遍历数组不起作用
- android - BLE 配置无头设备和 OTA 的选择