File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
biojava-structure/src/main/java/org/biojava/nbio/structure/contact Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 2828import java .io .Serializable ;
2929import java .util .Arrays ;
3030import java .util .Locale ;
31+ import java .util .Objects ;
3132
3233
3334/**
@@ -73,9 +74,12 @@ public BoundingBox(BoundingBox bb) {
7374 * Constructs a BoundingBox by calculating maxs and mins of given array of atoms.
7475 * @param atoms the atom array
7576 * @throws IllegalArgumentException if atom array is empty
77+ * @throws NullPointerException if input is null
7678 */
7779 public BoundingBox (Point3d [] atoms ) {
7880
81+ Objects .requireNonNull (atoms );
82+
7983 if (atoms .length ==0 )
8084 throw new IllegalArgumentException ("Empty list of atoms is not allowed for BoundingBox construction" );
8185
@@ -103,9 +107,12 @@ public BoundingBox (Point3d[] atoms) {
103107 * Given a set of bounding boxes returns a bounding box that bounds all of them.
104108 * @param boxes an array of bounding boxes
105109 * @throws IllegalArgumentException if input array is empty
110+ * @throws NullPointerException if input is null
106111 */
107112 public BoundingBox (BoundingBox [] boxes ) {
108113
114+ Objects .requireNonNull (boxes );
115+
109116 if (boxes .length ==0 )
110117 throw new IllegalArgumentException ("Empty list of bounding boxes is not allowed for BoundingBox construction" );
111118
Original file line number Diff line number Diff line change 11package org .biojava .nbio .structure .contact ;
22
3- import org .biojava .nbio .structure .*;
3+ import org .biojava .nbio .structure .Atom ;
4+ import org .biojava .nbio .structure .Calc ;
5+ import org .biojava .nbio .structure .Chain ;
6+ import org .biojava .nbio .structure .Group ;
7+ import org .biojava .nbio .structure .Structure ;
8+ import org .biojava .nbio .structure .StructureTools ;
49import org .biojava .nbio .structure .xtal .CrystalTransform ;
510import org .biojava .nbio .structure .xtal .SpaceGroup ;
611
712import javax .vecmath .Point3d ;
813import java .util .ArrayList ;
9- import java .util .Iterator ;
14+ import java .util .Collection ;
1015import java .util .List ;
11- import java .util .stream .IntStream ;
1216
1317/**
1418 * A class containing methods to find interfaces in a given structure.
@@ -37,11 +41,10 @@ public InterfaceFinder(Structure structure) {
3741 * Remove polymer chains with 0 atoms.
3842 */
3943 private void trimPolyChains () {
40- Iterator <Chain > it = polyChains .iterator ();
41- while (it .hasNext ()) {
42- int count = it .next ().getAtomGroups ().stream ().flatMapToInt (g -> IntStream .of (g .getAtoms ().size ())).sum ();
43- if (count ==0 ) it .remove ();
44- }
44+ polyChains .removeIf (chain -> {
45+ int count = chain .getAtomGroups ().stream ().map (Group ::getAtoms ).mapToInt (Collection ::size ).sum ();
46+ return count == 0 ;
47+ });
4548 }
4649
4750 /**
You can’t perform that action at this time.
0 commit comments