Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use Objects.hash() instead of custom hashCode() method#27

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
wumpz merged 1 commit intojava-diff-utils:masterfromkoppor:use-objects-hash
Oct 28, 2018
Merged
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,11 +63,7 @@ protected void verifyChunk(List<T> target) throws PatchFailedException {

@Override
public int hashCode() {
int hash = 3;
hash = 61 * hash + Objects.hashCode(this.source);
hash = 61 * hash + Objects.hashCode(this.target);
hash = 61 * hash + Objects.hashCode(this.type);
return hash;
return Objects.hash(this.source, this.target, this.type);
}

@Override
Expand Down
18 changes: 2 additions & 16 deletionssrc/main/java/com/github/difflib/patch/Chunk.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
* Holds the information about the part of text involved in the diff process
Expand DownExpand Up@@ -108,26 +109,11 @@ public int last() {
return getPosition() + size() - 1;
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((lines == null) ? 0 : lines.hashCode());
result = prime * result + position;
result = prime * result + size();
return result;
return Objects.hash(lines, position, size());
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
Expand Down
18 changes: 2 additions & 16 deletionssrc/main/java/com/github/difflib/text/DiffRow.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,7 @@
package com.github.difflib.text;

import java.io.Serializable;
import java.util.Objects;

/**
* Describes the diff row in form [tag, oldLine, newLine) for showing the difference between two texts
Expand DownExpand Up@@ -70,26 +71,11 @@ public String getNewLine() {
return newLine;
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((newLine == null) ? 0 : newLine.hashCode());
result = prime * result + ((oldLine == null) ? 0 : oldLine.hashCode());
result = prime * result + ((tag == null) ? 0 : tag.hashCode());
return result;
return Objects.hash(newLine, oldLine, tag);
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp