Skip to content
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

Code duplication in RtTransaction #59

Open
Vatavuk opened this issue Aug 4, 2018 · 3 comments
Open

Code duplication in RtTransaction #59

Vatavuk opened this issue Aug 4, 2018 · 3 comments

Comments

@Vatavuk
Copy link
Contributor

Vatavuk commented Aug 4, 2018

We have code duplication in RtTransaction. Each method parses transaction string in a same manner:

final String value = new UncheckedText(
    new IoCheckedScalar<>(
        new ItemAt<>(
            index, new SplitText(this.transaction, ";")
        )
    ).value()
).asString();

We can extract this to a method or a class.
Furthermore we can simplify the above example to:

final String ident = new IoCheckedScalar<>(
    () -> new ItemAt<>(0, new SplitText(this.transaction, ";"))
        .value().asString()
).value();
@0crat
Copy link
Collaborator

0crat commented Aug 4, 2018

@llorllale/z please, pay attention to this issue

@victornoel
Copy link
Contributor

@Vatavuk yes, or we could merge it with the pattern matching that follows and match the whole string instead of first splitting it by ;.
Check yegor256/cactoos#941 that I opened in cactoos that is related too.

@llorllale
Copy link
Collaborator

@Vatavuk let's wait for yegor256/cactoos#941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants