[
https://issues.apache.org/jira/browse/FLINK-888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14043637#comment-14043637
]
ASF GitHub Bot commented on FLINK-888:
--------------------------------------
Github user uce commented on the pull request:
https://github.com/apache/incubator-flink/pull/44#issuecomment-47119600
I suggest to create a new Tuple2 for the swap, because your current
solution only works because of type erasure.
The following would not work:
```java
Tuple2<String, Integer> classUnderTestTuple2 = new Tuple2<String,
Integer>(new String("Test case"), 25);
classUnderTestTuple2.swapValues();
String s1 = classUnderTestTuple2.f1; // does not work
Integer i1 = classUnderTestTuple2.f0; // does not work
```
So for swapValues() you would do something like `new Tuple2<T1, T0>(T1,
T0)`.
> Add swap() method to Tuple2
> ---------------------------
>
> Key: FLINK-888
> URL: https://issues.apache.org/jira/browse/FLINK-888
> Project: Flink
> Issue Type: Improvement
> Reporter: GitHub Import
> Assignee: Tobias
> Labels: github-import
> Fix For: pre-apache
>
>
> In line with Scala
> ---------------- Imported from GitHub ----------------
> Url: https://github.com/stratosphere/stratosphere/issues/888
> Created by: [StephanEwen|https://github.com/StephanEwen]
> Labels: enhancement, java api,
> Milestone: Release 0.6 (unplanned)
> Created at: Thu May 29 14:49:49 CEST 2014
> State: open
--
This message was sent by Atlassian JIRA
(v6.2#6252)