Use StringBuilder instead of StringBuffer
- Lingua principale
- Java
- Stelle
- 3.1k
- Fork
- 1.6k
- Merge medio
- 3g 12h
- PR unite (30g)
- 33
Descrizione
```java
private StringBuffer currentLine = new StringBuffer();
....
public String nextToken() {
while (st.hasMoreTokens()) {
String t = st.nextToken();
if (t.equals("\n")) {
++ line;
currentLine.setLength(0);
} else {
currentLine.append(t);
}
if (!isWhitespace(t)) {
return t;
}
}
throw new IllegalArgumentException("unexpected end of schema");
}
```
Use `StringBuilder` instead of `StringBuffer` as `StringBuffer` is synchronized (which is not required here).
**Reporter**: [David Mollitor](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=belugabehr) / @belugabehr
**Note**: *This issue was originally created as [PARQUET-1921](https://issues.apache.org/jira/browse/PARQUET-1921). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Cerca nel repository la dichiarazione StringBuffer mostrata e l'utilizzo di currentLine, quindi leggi il codice circostante del tokenizer per confermare che il buffer non sia condiviso tra i thread. Sostituisci l'utilizzo identificato con StringBuilder ed esegui il comando di build o test Java pertinente del repository per verificare che il tokenizer continui a comportarsi correttamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- data-engineering
- Tipo di issue
- Refactoring
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100