java take_java – first()和take(1)之间的区别

不同的是,take(1)将从上游中继0..1项,而如果上游为空,则首先将中继第一个元素或发出错误(NoSuchElementException).他们都没有阻止.

这是真的第一个== take(1).single()其中take(1)将上游项的数量限制为1,而单()使上游不为空.

此示例仅打印“完成”

Observable.empty().take(1)

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

此示例打印“1”,后跟“完成”:

Observable.just(1).take(1)

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

此示例还打印“1”,后跟“完成”:

Observable.just(1, 2, 3).take(1)

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

此示例与NoSuchElementException失败

Observable.empty().first()

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

此示例再次打印“1”,后跟“完成”:

Observable.just(1).first()

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

此示例再次打印“1”,后跟“完成”:

Observable.just(1, 2, 3).first()

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

此示例打印一个NoSuchElementException的堆栈跟踪,因为源包含的元素太少:

Observable.empty().single()

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

此示例打印IllegalArgumentException的堆栈跟踪,因为源包含太多元素:

Observable.just(1, 2, 3).single()

.subscribe(System.out::println, Throwable::printStackTrace,

() -> System.out.println("Done"));

帮我把这段xml,用@Data注解转成java bean实体,每个字段上都要加上@XStreamAlias注解 <FLIGHT> <FID>b59bb8fa48ad6edbf35f7f468019d06d</FID> <DATA_TYPE>操作类型:INSEERT、UPDATE、DELETE</DATA_TYPE> <FLIGHT_ID>0或者例如:ZH9847-2020-08-18-A</FLIGHT_ID> <AIRLINE_IATA>ZH</AIRLINES_IATA> <AIRLINE_ICAO>CSZ</AIRLINES_ICAO> <FLIGHT_NO>ZH9487</FLIGHT_NO> <DAP_AP>CTU</DAP_AP> <AAP_AP>JJN</AAP_AP> <FLINES>JJN,HGH,SJW</FLINES> <REG_NUMBER>B3207</REG_NUMBER> <FLIGHT_STATUS>0</FLIGHT_STATUS> <FLIGHT_DATE>20200820</FLIGHT_DATE> <PLAN_TAKEOFF_TIME>20200820153628<PLAN_TAKEOFF_TIME> <PLAN_LANDIN_TIME>20200820153628</PLAN_LANDIN_TIME> <ESTIMATED_TAKEOFF_TIME>20200820153628</ESTIMATED_TAKEOFF_TIME> <ESTIMATE_LANDIN_TIME>20200820153628</ESTIMATE_LANDIN_TIME> <REAL_TAKEOFF_TIME>20200820153628</REAL_TAKEOFF_TIME> <REAL_LANDIN_TIME>20200820153628</REAL_TAKEOFF_TIME> <FLY_DISTANCE>1302</FLY_DISTANCE> <DEP_STAND>22</DEP_STAND> <ARR_STAND>32</ARR_STAND> <TOUCH_DOWN_RUNWAY>03</TOUCH_DOWN_RUNWAY> <TAKE_OFF_RUNWAY>03</TAKE_OFF_RUNWAY> <DEP_GATE>09</DEP_GATE> <CHECKIN_COUNTER></CHECKIN_COUNTER> <CHECKIN_COUNTER2></CHECKIN_COUNTER2> <LUGGAGE_TURNTABLE>2DA</LUGGAGE_TURNTABLE> <LUGGAGE_TURNTABLE2>2DB</LUGGAGE_TURNTABLE2> <DORI>0</DORI> <MISSION_PROPERTY>W/Z</MISSION_PROPERTY> <IS_SHARE>0</IS_SHARE> <SHARE_MAIN_FLIGHT>ZH8701</SHARE_MAIN_FLIGHT> <IS_VIP>0</IS_VIP> <ALNAP></ALNAP> <FIRST_POINT></FIRST_POINT> <AIRWAY_POINTS> </AIRWAY_POINTS> <ROUTE></ROUTE> <DELAY_REASON_PUID>0</DELAY_REASON_PUID> <DELAY_REASON_CLIENT></DELAY_REASON_CLIENT> <DELAY_TYPE></DELAY_TYPE> <DELAY_REASON></DELAY_REASON> </FLIGHT>
最新发布
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值