Skip to content

Remove 'new' keyword when creating instances of case class #1522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _ba/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Graph {
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ class Graph {
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
2 changes: 1 addition & 1 deletion _ba/tour/lower-type-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ case class EuropeanSwallow() extends Bird

val africanSwallowList= ListNode[AfricanSwallow](AfricanSwallow(), Nil())
val birdList: Node[Bird] = africanSwallowList
birdList.prepend(new EuropeanSwallow)
birdList.prepend(EuropeanSwallow())
```
`Node[Bird]` može biti dodijeljena `africanSwallowList` ali onda prihvatiti `EuropeanSwallow`e.
4 changes: 2 additions & 2 deletions _es/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ En Scala es posible que las clases tengan como miembro otras clases. A diferenci
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -71,7 +71,7 @@ Por favor note que en Java la última linea del ejemplo anterior hubiese sido co
class Node {
var connectedNodes: List[Graph#Node] = Nil // Graph#Node en lugar de Node
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
4 changes: 2 additions & 2 deletions _ja/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Graph {
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ class Graph {
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
2 changes: 1 addition & 1 deletion _ja/tour/lower-type-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ case class EuropeanSwallow() extends Bird

val africanSwallowList= ListNode[AfricanSwallow](AfricanSwallow(), Nil())
val birdList: Node[Bird] = africanSwallowList
birdList.prepend(new EuropeanSwallow)
birdList.prepend(EuropeanSwallow())
```
`Node[Bird]`は`africanSwallowList`をアサインできますが、その後`EuropeanSwallow`を受け入れられます。

2 changes: 1 addition & 1 deletion _ja/tour/singleton-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ object Circle {
private def calculateArea(radius: Double): Double = Pi * pow(radius, 2.0)
}

val circle1 = new Circle(5.0)
val circle1 = Circle(5.0)

circle1.area
```
Expand Down
4 changes: 2 additions & 2 deletions _ko/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ previous-page: lower-type-bounds
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -70,7 +70,7 @@ previous-page: lower-type-bounds
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
4 changes: 2 additions & 2 deletions _pl/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Graph {
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -79,7 +79,7 @@ class Graph {
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
4 changes: 2 additions & 2 deletions _pt-br/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Graph {
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -78,7 +78,7 @@ class Graph {
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
4 changes: 2 additions & 2 deletions _ru/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Graph {
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -66,7 +66,7 @@ class Graph {
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
2 changes: 1 addition & 1 deletion _ru/tour/lower-type-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ case class EuropeanSwallow() extends Bird

val africanSwallowList= ListNode[AfricanSwallow](AfricanSwallow(), Nil())
val birdList: Node[Bird] = africanSwallowList
birdList.prepend(new EuropeanSwallow)
birdList.prepend(EuropeanSwallow())
```
`Node[Bird]` может быть присвоен `africanSwallowList` , но затем может добавлять и `EuropeanSwallow`.
2 changes: 1 addition & 1 deletion _ru/tour/singleton-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object Circle {
private def calculateArea(radius: Double): Double = Pi * pow(radius, 2.0)
}

val circle1 = new Circle(5.0)
val circle1 = Circle(5.0)

circle1.area
```
Expand Down
4 changes: 2 additions & 2 deletions _tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Graph {
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node): Unit = {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -63,7 +63,7 @@ class Graph {
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node): Unit = {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
2 changes: 1 addition & 1 deletion _tour/lower-type-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ case class EuropeanSwallow() extends Bird

val africanSwallowList= ListNode[AfricanSwallow](AfricanSwallow(), Nil())
val birdList: Node[Bird] = africanSwallowList
birdList.prepend(new EuropeanSwallow)
birdList.prepend(EuropeanSwallow())
```
The `Node[Bird]` can be assigned the `africanSwallowList` but then accept `EuropeanSwallow`s.
2 changes: 1 addition & 1 deletion _tour/singleton-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object Circle {
private def calculateArea(radius: Double): Double = Pi * pow(radius, 2.0)
}

val circle1 = new Circle(5.0)
val circle1 = Circle(5.0)

circle1.area
```
Expand Down
4 changes: 2 additions & 2 deletions _zh-cn/tour/inner-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Graph {
class Node {
var connectedNodes: List[Node] = Nil
def connectTo(node: Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down Expand Up @@ -64,7 +64,7 @@ class Graph {
class Node {
var connectedNodes: List[Graph#Node] = Nil
def connectTo(node: Graph#Node) {
if (connectedNodes.find(node.equals).isEmpty) {
if (!connectedNodes.exists(node.equals)) {
connectedNodes = node :: connectedNodes
}
}
Expand Down
2 changes: 1 addition & 1 deletion _zh-cn/tour/lower-type-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ case class EuropeanSwallow() extends Bird

val africanSwallowList= ListNode[AfricanSwallow](AfricanSwallow(), Nil())
val birdList: Node[Bird] = africanSwallowList
birdList.prepend(new EuropeanSwallow)
birdList.prepend(EuropeanSwallow())
```
可以为 `Node[Bird]` 赋值 `africanSwallowList`,然后再加入一个 `EuropeanSwallow`。
2 changes: 1 addition & 1 deletion _zh-cn/tour/singleton-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object Circle {
private def calculateArea(radius: Double): Double = Pi * pow(radius, 2.0)
}

val circle1 = new Circle(5.0)
val circle1 = Circle(5.0)

circle1.area
```
Expand Down