@@ -241,23 +241,43 @@ public String toString() {
241241 }
242242 };
243243
244- public static final Builder <Map <byte [], byte []>> BINARY_MAP_FROM_PAIRS = new Builder <Map <byte [], byte []>>() {
244+ public static final Builder <List < Map . Entry <byte [], byte []>>> BINARY_PAIR_LIST = new Builder <List < Map . Entry <byte [], byte []> >>() {
245245 @ Override
246246 @ SuppressWarnings ("unchecked" )
247- public Map <byte [], byte []> build (Object data ) {
247+ public List <Map .Entry <byte [], byte []>> build (Object data ) {
248+ final List <byte []> flatHash = (List <byte []>) data ;
249+ final List <Map .Entry <byte [], byte []>> pairList = new ArrayList <>();
250+ final Iterator <byte []> iterator = flatHash .iterator ();
251+ while (iterator .hasNext ()) {
252+ pairList .add (new AbstractMap .SimpleEntry <>(iterator .next (), iterator .next ()));
253+ }
254+
255+ return pairList ;
256+ }
257+
258+ @ Override
259+ public String toString () {
260+ return "List<Map.Entry<byte[], byte[]>>" ;
261+ }
262+ };
263+
264+ public static final Builder <List <Map .Entry <byte [], byte []>>> BINARY_PAIR_LIST_FROM_PAIRS = new Builder <List <Map .Entry <byte [], byte []>>>() {
265+ @ Override
266+ @ SuppressWarnings ("unchecked" )
267+ public List <Map .Entry <byte [], byte []>> build (Object data ) {
248268 final List <Object > list = (List <Object >) data ;
249- final Map <byte [], byte []> map = new JedisByteHashMap ();
269+ final List < Map . Entry <byte [], byte []>> pairList = new ArrayList <> ();
250270 for (Object object : list ) {
251271 final List <byte []> flat = (List <byte []>) object ;
252- map . put ( flat .get (0 ), flat .get (1 ));
272+ pairList . add ( new AbstractMap . SimpleEntry <>( flat .get (0 ), flat .get (1 ) ));
253273 }
254274
255- return map ;
275+ return pairList ;
256276 }
257277
258278 @ Override
259279 public String toString () {
260- return "Map<byte[], byte[]>" ;
280+ return "List< Map.Entry <byte[], byte[]> >" ;
261281 }
262282 };
263283
@@ -335,6 +355,48 @@ public String toString() {
335355 }
336356 };
337357
358+ public static final Builder <List <Map .Entry <String , String >>> STRING_PAIR_LIST = new Builder <List <Map .Entry <String , String >>>() {
359+ @ Override
360+ @ SuppressWarnings ("unchecked" )
361+ public List <Map .Entry <String , String >> build (Object data ) {
362+ final List <byte []> flatHash = (List <byte []>) data ;
363+ final List <Map .Entry <String , String >> pairList = new ArrayList <>();
364+ final Iterator <byte []> iterator = flatHash .iterator ();
365+ while (iterator .hasNext ()) {
366+ pairList .add (new AbstractMap .SimpleEntry <>(STRING .build (iterator .next ()), STRING .build (iterator .next ())));
367+ }
368+
369+ return pairList ;
370+ }
371+
372+ @ Override
373+ public String toString () {
374+ return "List<Map.Entry<String, String>>" ;
375+ }
376+
377+ };
378+
379+ public static final Builder <List <Map .Entry <String , String >>> STRING_PAIR_LIST_FROM_PAIRS = new Builder <List <Map .Entry <String , String >>>() {
380+ @ Override
381+ @ SuppressWarnings ("unchecked" )
382+ public List <Map .Entry <String , String >> build (Object data ) {
383+ final List <Object > list = (List <Object >) data ;
384+ final List <Map .Entry <String , String >> pairList = new ArrayList <>();
385+ for (Object object : list ) {
386+ final List <byte []> flat = (List <byte []>) object ;
387+ pairList .add (new AbstractMap .SimpleEntry <>(SafeEncoder .encode (flat .get (0 )), SafeEncoder .encode (flat .get (1 ))));
388+ }
389+
390+ return pairList ;
391+ }
392+
393+ @ Override
394+ public String toString () {
395+ return "List<Map.Entry<String, String>>" ;
396+ }
397+
398+ };
399+
338400 public static final Builder <KeyedListElement > KEYED_LIST_ELEMENT = new Builder <KeyedListElement >() {
339401 @ Override
340402 @ SuppressWarnings ("unchecked" )
0 commit comments