All Projects → javadev → Underscore Java

javadev / Underscore Java

Licence: mit
java port of Underscore.js

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Underscore Java

Bible
Bible: JSON + XML
Stars: ✭ 246 (-24.77%)
Mutual labels:  json, xml
Tableexport
tableExport(table导出文件,支持json、csv、txt、xml、word、excel、image、pdf)
Stars: ✭ 261 (-20.18%)
Mutual labels:  json, xml
X2struct
Convert between json string and c++ object. json字符串和c++结构体之间互相转换
Stars: ✭ 251 (-23.24%)
Mutual labels:  json, xml
Horaires Ratp Api
Webservice pour les horaires et trafic RATP en temps réel
Stars: ✭ 232 (-29.05%)
Mutual labels:  json, xml
Sq
swiss-army knife for data
Stars: ✭ 275 (-15.9%)
Mutual labels:  json, xml
Il Ilce Mahalle Sokak Cadde Sql
Türkiye İl, İlçe, Mahalle, Sokak, Cadde Bilgisi SQL Şeklinde
Stars: ✭ 235 (-28.13%)
Mutual labels:  json, xml
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+787.77%)
Mutual labels:  json, xml
Parse
Go parsers for web formats
Stars: ✭ 224 (-31.5%)
Mutual labels:  json, xml
Korio
Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3
Stars: ✭ 282 (-13.76%)
Mutual labels:  json, xml
Loaders.gl
Loaders for big data visualization. Website:
Stars: ✭ 272 (-16.82%)
Mutual labels:  json, xml
Libyang
YANG data modeling language library
Stars: ✭ 227 (-30.58%)
Mutual labels:  json, xml
Http Rpc
Lightweight REST for Java
Stars: ✭ 298 (-8.87%)
Mutual labels:  json, xml
Konf
A type-safe cascading configuration library for Kotlin/Java/Android, supporting most configuration formats
Stars: ✭ 225 (-31.19%)
Mutual labels:  json, xml
Minify
Go minifiers for web formats
Stars: ✭ 2,824 (+763.61%)
Mutual labels:  json, xml
Apiproblem
A simple implementation of the api-problem specification. Includes PSR-15 support.
Stars: ✭ 225 (-31.19%)
Mutual labels:  json, xml
Swift Utils
A collection of handy swift utils
Stars: ✭ 253 (-22.63%)
Mutual labels:  json, xml
Biblia
Bíblia: XML + SQL + JSON
Stars: ✭ 211 (-35.47%)
Mutual labels:  json, xml
Renderer
Simple, lightweight and faster response (JSON, JSONP, XML, YAML, HTML, File) rendering package for Go
Stars: ✭ 220 (-32.72%)
Mutual labels:  json, xml
Oscal
Open Security Controls Assessment Language (OSCAL)
Stars: ✭ 272 (-16.82%)
Mutual labels:  json, xml
Visualjson
JSON pretty-viewer for OS X.
Stars: ✭ 290 (-11.31%)
Mutual labels:  json, xml

underscore-java

Maven Central MIT License Build Status Coverage Status codecov CircleCI Codeship Status for javadev/underscore-java wercker status Build status Build Status Run Status Known Vulnerabilities Codacy Badge Sputnik Code Scene Quality Gate Quality Gate Scrutinizer Build Status Hits-of-Code Java Version

Join the chat at https://gitter.im/javadev/underscore-java

Requirements

Java 1.8 and later or Java 11.

Installation

Include the following in your pom.xml for Maven:

<dependencies>
  <dependency>
    <groupId>com.github.javadev</groupId>
    <artifactId>underscore</artifactId>
    <version>1.64</version>
  </dependency>
  ...
</dependencies>

Gradle:

compile 'com.github.javadev:underscore:1.64'

Usage

U.of(/* array | list | set | map | anything based on Iterable interface */)
    .filter(..)
    .map(..)
    ...
    .sortWith()
    .forEach(..);
U.of(value1, value2, value3)...
U.range(0, 10)...

U.of(1, 2, 3) // or java.util.Arrays.asList(1, 2, 3) or new Integer[] {1, 2, 3}
    .filter(v -> v > 1)
    // 2, 3
    .map(v -> v + 1)
    // 3, 4
    .sortWith((a, b) -> b.compareTo(a))
    // 4, 3
    .forEach(System.out::println);
    // 4, 3
    
U.formatXml("<a><b>data</b></a>");
    // <a>
    //    <b>data</b>
    // </a>

U.formatJson("{\"a\":{\"b\":\"data\"}}");
    // {
    //    "a": {
    //      "b": "data"
    //    }
    // }

U.xmlToJson("<a attr=\"c\"><b>data</b></a>");
    // {
    //   "a": {
    //     "-attr": "c",
    //     "b": "data"
    //   },
    //   "#omit-xml-declaration": "yes"
    // }

U.jsonToXml("{\"a\":{\"-attr\":\"c\",\"b\":\"data\"}}");
    // <?xml version="1.0" encoding="UTF-8"?>
    // <a attr="c">
    //   <b>data</b>
    // </a>

U.Builder builder = U.objectBuilder()
    .add("firstName", "John")
    .add("lastName", "Smith")
    .add("age", 25)
    .add("address", U.arrayBuilder()
        .add(U.objectBuilder()
            .add("streetAddress", "21 2nd Street")
            .add("city", "New York")
            .add("state", "NY")
            .add("postalCode", "10021")))
    .add("phoneNumber", U.arrayBuilder()
        .add(U.objectBuilder()
            .add("type", "home")
            .add("number", "212 555-1234"))
        .add(U.objectBuilder()
            .add("type", "fax")
            .add("number", "646 555-4567")));
System.out.println(builder.toJson());
System.out.println(builder.toXml());
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25,
  "address": [
    {
      "streetAddress": "21 2nd Street",
      "city": "New York",
      "state": "NY",
      "postalCode": "10021"
    }
  ],
  "phoneNumber": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "fax",
      "number": "646 555-4567"
    }
  ]
}
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <firstName>John</firstName>
  <lastName>Smith</lastName>
  <age number="true">25</age>
  <address array="true">
    <streetAddress>21 2nd Street</streetAddress>
    <city>New York</city>
    <state>NY</state>
    <postalCode>10021</postalCode>
  </address>
  <phoneNumber>
    <type>home</type>
    <number>212 555-1234</number>
  </phoneNumber>
  <phoneNumber>
    <type>fax</type>
    <number>646 555-4567</number>
  </phoneNumber>
</root>

Underscore-java is a java port of Underscore.js.

In addition to porting Underscore's functionality, Underscore-java includes matching unit tests.

For docs, license, tests, and downloads, see: https://javadev.github.io/underscore-java

Thanks to Jeremy Ashkenas and all contributors to Underscore.js.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].