@@ -363,10 +363,7 @@ public DBCursor skip( int n ){
363363 * @return the cursor id, or 0 if there is no active cursor.
364364 */
365365 public long getCursorId () {
366- if (_it != null )
367- return _it .getCursorId ();
368-
369- return 0 ;
366+ return _it == null ? 0 : _it .getCursorId ();
370367 }
371368
372369 /**
@@ -522,25 +519,15 @@ private DBObject _next() {
522519 * @return
523520 */
524521 public int numGetMores () {
525- if (_it != null ) {
526- return _it .numGetMores ();
527- }
528- else {
529- return 0 ;
530- }
522+ return _it == null ? 0 : _it .numGetMores ();
531523 }
532524
533525 /**
534526 * gets a list containing the number of items received in each batch
535527 * @return
536528 */
537- public List <Integer > getSizes (){
538- if (_it != null ) {
539- return _it .getSizes ();
540- }
541- else {
542- return Collections .emptyList ();
543- }
529+ public List <Integer > getSizes () {
530+ return _it == null ? Collections .<Integer >emptyList () : _it .getSizes ();
544531 }
545532
546533 private boolean _hasNext () {
@@ -568,7 +555,7 @@ public int numSeen(){
568555 * @throws MongoException
569556 */
570557 public boolean hasNext () {
571- _checkType ( CursorType .ITERATOR );
558+ _checkType (CursorType .ITERATOR );
572559 return _hasNext ();
573560 }
574561
@@ -587,7 +574,7 @@ public DBObject next() {
587574 * @return the current element
588575 */
589576 public DBObject curr (){
590- _checkType ( CursorType .ITERATOR );
577+ _checkType (CursorType .ITERATOR );
591578 return _cur ;
592579 }
593580
@@ -722,10 +709,7 @@ public DBCollection getCollection(){
722709 * @return
723710 */
724711 public ServerAddress getServerAddress () {
725- if (_it != null )
726- return _it .getServerAddress ();
727-
728- return null ;
712+ return _it == null ? null : _it .getServerAddress ();
729713 }
730714
731715 /**
0 commit comments