mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8337168: Optimize LocalDateTime.toString
Reviewed-by: liach, naoto
This commit is contained in:
parent
374fca0fcb
commit
5ff7c57f9f
3 changed files with 30 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1965,7 +1965,11 @@ public final class LocalDateTime
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return date.toString() + 'T' + time.toString();
|
||||
var buf = new StringBuilder(29);
|
||||
date.formatTo(buf);
|
||||
buf.append('T');
|
||||
time.formatTo(buf);
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue