Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Colebourne jodastephen

View GitHub Profile
@jodastephen
jodastephen / OffsetIdPrinterParser
Last active May 31, 2016
Proposed OffsetIdPrinterParser changes
View OffsetIdPrinterParser
//-----------------------------------------------------------------------
/**
* Prints or parses an offset ID.
*/
static final class OffsetIdPrinterParser implements DateTimePrinterParser {
static final String[] PATTERNS = new String[] {
"+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS", "+HHmmss", "+HH:mm:ss",
"+H", "+Hmm", "+H:mm", "+HMM", "+H:MM", "+HMMss", "+H:MM:ss", "+HMMSS", "+H:MM:SS", "+Hmmss", "+H:mm:ss",
}; // order used in pattern builder
static final OffsetIdPrinterParser INSTANCE_ID_Z = new OffsetIdPrinterParser("+HH:MM:ss", "Z");
View Collection serialization
// released to the public domain, no copyright applies
package com.opengamma.strata.calc;
import java.io.ByteArrayOutputStream;
import java.io.Externalizable;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
@jodastephen
jodastephen / StandardZoneOffsets
Created Aug 9, 2014
Changes in the standard offset (ignoring DST) for most time-zones
View StandardZoneOffsets
Version: 2013h
Africa/Abidjan
-00:16:08
Z Transition[Gap at 1912-01-01T00:00-00:16:08 to Z]
Africa/Accra
-00:00:52
Z Transition[Gap at 1918-01-01T00:00-00:00:52 to Z]
View DateTimeFormatterWithZone.patch
# HG changeset patch
# User scolebourne
# Date 1394626494 0
# Node ID 7b1e9663ed48d903ee6ce1b21e9e9bab8ea17623
# Parent e66f488e6f7fa6a3be8d1254d0c52bda346b9574
JDK-8033662 DateTimeFormatter doesn't set zone when parsing
diff --git a/src/share/classes/java/time/format/DateTimeParseContext.java b/src/share/classes/java/time/format/DateTimeParseContext.java
--- a/src/share/classes/java/time/format/DateTimeParseContext.java
+++ b/src/share/classes/java/time/format/DateTimeParseContext.java
View CLDgenerics.patch
# HG changeset patch
# User scolebourne
# Date 1394127972 0
# Node ID e66f488e6f7fa6a3be8d1254d0c52bda346b9574
# Parent c307f1e300d9d9d620ff17ec22437fc7d4b63592
JDK-8036785 - ChronoLocalDate refers to generics that have been removed
diff --git a/src/share/classes/java/time/chrono/ChronoLocalDate.java b/src/share/classes/java/time/chrono/ChronoLocalDate.java
--- a/src/share/classes/java/time/chrono/ChronoLocalDate.java
+++ b/src/share/classes/java/time/chrono/ChronoLocalDate.java
View WithResolverFields.patch
# HG changeset patch
# User scolebourne
# Date 1394127067 0
# Node ID c307f1e300d9d9d620ff17ec22437fc7d4b63592
# Parent 5fa8324688fe78e43799053eab88e3e643e1d34b
JDK-8036818 - DateTimeFormatter withResolverFields() fails to accept null
diff --git a/src/share/classes/java/time/format/DateTimeFormatter.java b/src/share/classes/java/time/format/DateTimeFormatter.java
--- a/src/share/classes/java/time/format/DateTimeFormatter.java
+++ b/src/share/classes/java/time/format/DateTimeFormatter.java
View LocalTime.with.patch
# HG changeset patch
# User scolebourne
# Date 1394126180 0
# Node ID 5fa8324688fe78e43799053eab88e3e643e1d34b
# Parent 39a459cf1bcb80922c4f6b04a46743cd8baf824e
JDK-8035099 - LocalTime.with
diff --git a/src/share/classes/java/time/LocalTime.java b/src/share/classes/java/time/LocalTime.java
--- a/src/share/classes/java/time/LocalTime.java
+++ b/src/share/classes/java/time/LocalTime.java
View Typos.patch
# HG changeset patch
# User scolebourne
# Date 1394124690 0
# Node ID a5bc7c88421b53704ee24c7a7cd003fec3a0cbc2
# Parent 164623eb3a9de2bc6c17831a2eb0e02cad770994
Fix typos and enhance Javadoc
diff --git a/src/share/classes/java/time/DayOfWeek.java b/src/share/classes/java/time/DayOfWeek.java
--- a/src/share/classes/java/time/DayOfWeek.java
+++ b/src/share/classes/java/time/DayOfWeek.java
@jodastephen
jodastephen / Reduced
Created Sep 22, 2013
Patch for reduced print/parse
View Reduced
diff -r b7f9218d0f37 src/share/classes/java/time/format/DateTimeFormatterBuilder.java
--- a/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Sat Sep 14 22:54:38 2013 +0100
+++ b/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Sun Sep 22 07:24:24 2013 -0700
@@ -78,9 +78,11 @@
import java.text.ParsePosition;
import java.time.DateTimeException;
import java.time.Instant;
+import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
@jodastephen
jodastephen / CollectionOf
Created Sep 22, 2013
Patch proposing additing of() static methods to the collection interfaces.
View CollectionOf
diff -r b7f9218d0f37 src/share/classes/java/util/Collection.java
--- a/src/share/classes/java/util/Collection.java Sat Sep 14 22:54:38 2013 +0100
+++ b/src/share/classes/java/util/Collection.java Sun Sep 22 05:35:55 2013 -0700
@@ -135,6 +135,30 @@
*/
public interface Collection<E> extends Iterable<E> {
+
+ /**
+ * Returns an immutable collection consisting of the specified elements.