com.example.mistakes.expression._11_IgnoredReturnValue.Ex4

🚀 com.example.mistakes.expression._11_IgnoredReturnValue.Ex4

Question fetched from API endpoint api/expression/11/4

API Response

GET /api/expression/11/4
{
  "result": [
    {
      "message": "com.example.mistakes.expression._11_IgnoredReturnValue.Ex4",
      "before": "    BitSet before(BitSet s1, BitSet s2) {\n      s1.intersects(s2);\n      return s1;\n    }\n",
      "after": "    BitSet after(BitSet s1, BitSet s2) {\n      s1.and(s2);\n      return s1;\n    }\n",
      "chapter": 2,
      "id": "2_11_4",
      "className": "Ex4",
      "path": "file:///home/runner/work/100_java_mistakes/100_java_mistakes/back/src/main/java/com/example/mistakes/expression/_11_IgnoredReturnValue.java"
    }
  ],
  "length": 1
}

before

before
BitSet before(BitSet s1, BitSet s2) {
  s1.intersects(s2);
  return s1;
}

after

after
BitSet after(BitSet s1, BitSet s2) {
  s1.and(s2);
  return s1;
}