Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java中在集合中传递参数的目的_Java - Fatal编程技术网

java中在集合中传递参数的目的

java中在集合中传递参数的目的,java,Java,我看到一个返回方法,其参数如下: return new HashSet<Books>(bookService.getBookData(Books.class,customer.getVisitingCustomer); 返回新的HashSet(bookService.getBookData(Books.class,customer.getVisitingCustomer); 但是我不能理解将Books.class、customer.getVisitingCustomer作为参数传

我看到一个返回方法,其参数如下:

return new HashSet<Books>(bookService.getBookData(Books.class,customer.getVisitingCustomer);
返回新的HashSet(bookService.getBookData(Books.class,customer.getVisitingCustomer);
但是我不能理解将Books.class、customer.getVisitingCustomer作为参数传递的想法。我有时也会 是否查看两个以上的参数

有人能解释一下在集合中传递参数的目的吗?

代码(已修复)大概是

涉及三项业务,

  • customer.getVisitingCustomer()
  • bookService.getBookData(Books.class,)
  • 返回新的HashSet()

  • 第一种方法是从
    客户
    检索来访客户。第二种方法调用
    bookService
    方法,该方法接受
    Books.class
    (可能执行某种形式的操作)。第三种方法则强制该方法的结果是唯一的(一个
    集合
    ).

    这与
    HashSet
    无关,而是与
    getBookData(类)的实现有关
    
    return new HashSet(bookService.getBookData(Books.class,
            customer.getVisitingCustomer()));