[问题] 一直看不懂官方API的一些表示方法[Java_General]

楼主: d0068267 (WizXu)   2021-08-10 02:51:56
不好意思一直有一个问题困扰我很久,目前也没有找不到答案。
我在读官方API的时候,有些符号一直看不懂,像是
t.ly/x64V
类别 Optional<T>里面的方法flatMap
==========================================
flatMap
public <U> Optional<U> flatMapFunction<? super T, extends Optional<?
extends U>> mapper)
==========================================
这一段要怎么去识读?
<? 是什么意思
super T要是什么意思
extends是继承吗?
这方面有什么解释文件可以阅读吗?一直搞不懂在哪里有讲解。
不知道哪边有解释,再麻烦大大解惑,感恩。
我之前都是拿看不懂的东西去google别人会解释,但觉得这不是长久之道
所以想了解怎么阅读官方API的表示方法
Description:
If a value is present, returns the result of applying the given
Optional-bearing mapping function to the value, otherwise returns an empty
Optional.
This method is similar to map(Function), but the mapping function is one
whose result is already an Optional, and if invoked, flatMap does not wrap it
within an additional Optional.
Type Parameters:
U - The type of value of the Optional returned by the mapping function
Parameters:
mapper - the mapping function to apply to a value, if present
Returns:
the result of applying an Optional-bearing mapping function to the value of
this Optional, if a value is present, otherwise an empty Optional
Throws:
NullPointerException - if the mapping function is null or returns a null
result
作者: LPH66 (-6.2598534e+18f)   2021-08-10 03:21:00
关键字: java generic wildcard这个是正式的 java 语法喔
作者: ppc ( )   2021-08-10 18:29:00
https://tinyurl.com/3a7t5t6j 这个给你参考
作者: aidansky0989 (alta)   2021-08-10 19:28:00
你先找一套Java基础语法过一下,认识一下多型,<T>这个是泛型,很实用的

Links booklink

Contact Us: admin [ a t ] ucptt.com