• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CaseInsensitiveMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.collections4.map.CaseInsensitiveMap的典型用法代码示例。如果您正苦于以下问题:Java CaseInsensitiveMap类的具体用法?Java CaseInsensitiveMap怎么用?Java CaseInsensitiveMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CaseInsensitiveMap类属于org.apache.commons.collections4.map包,在下文中一共展示了CaseInsensitiveMap类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
public static void main(String[] args)
{
   Map<String, String> map = PredicatedMap.predicatedMap(new CaseInsensitiveMap<String, String>(), NotNullPredicate.notNullPredicate(), NotNullPredicate.notNullPredicate());

   map.put("one", "A");

   System.out.println(map);
   System.out.printf("using oNe as the key to get the value from the map: %s\n", map.get("oNe"));
   System.out.println("Going to put a null key on the map");

   try
   {
      map.put(null, "B");
   }
   catch(Exception e) //I don't like that this process throws an exception.  I'd much rather it just not put a null key in.
   {
      System.out.println(e.getMessage());
   }

   //so to fix this I implemented my own using the abstractions provided by Commons Collections 4
   Map<String, String> map2 = new FilteringPredicatedMap<>();

   map2.put("one", "A");
   map2.put(null, "B");
   map2.put("three", null);
   map2.put("four", "D");

   System.out.println(map2);

   Map<String, String> map3 = new FilteringPredicatedMap<>(new TreeMap<>(), (i -> i != null && i.equals("one")), FilteringPredicatedMap.nullPredicateInstance());

   map3.put("one", "A");
   map3.put(null, "B");
   map3.put("three", null);
   map3.put("four", "D");

   System.out.println(map3);
}
 
开发者ID:developerSid,项目名称:AwesomeJavaLibraryExamples,代码行数:39,代码来源:ExampleNonNullCaseInsensitiveMap.java


示例2: generateColumnLabelIndexMap

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
private Map<String, Integer> generateColumnLabelIndexMap() throws SQLException {
    ResultSetMetaData resultSetMetaData = resultSets.get(0).getMetaData();
    Map<String, Integer> result = new CaseInsensitiveMap<String, Integer>(resultSetMetaData.getColumnCount());
    for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
        result.put(resultSetMetaData.getColumnLabel(i), i);
    }
    return result;
}
 
开发者ID:balancebeam,项目名称:sherlock,代码行数:9,代码来源:AbstractResultSetAdapter.java


示例3: createAuditLogEntry

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
public AuditLogEntry createAuditLogEntry(GuildImpl guild, JSONObject entryJson, JSONObject userJson)
{
    final long targetId = Helpers.optLong(entryJson, "target_id", 0);
    final long id = entryJson.getLong("id");
    final int typeKey = entryJson.getInt("action_type");
    final JSONArray changes = entryJson.isNull("changes") ? null : entryJson.getJSONArray("changes");
    final JSONObject options = entryJson.isNull("options") ? null : entryJson.getJSONObject("options");
    final String reason = entryJson.optString("reason", null);

    final UserImpl user = (UserImpl) createFakeUser(userJson, false);
    final Set<AuditLogChange> changesList;
    final ActionType type = ActionType.from(typeKey);

    if (changes != null)
    {
        changesList = new HashSet<>(changes.length());
        for (int i = 0; i < changes.length(); i++)
        {
            final JSONObject object = changes.getJSONObject(i);
            AuditLogChange change = createAuditLogChange(object);
            changesList.add(change);
        }
    }
    else
    {
        changesList = Collections.emptySet();
    }

    CaseInsensitiveMap<String, AuditLogChange> changeMap = new CaseInsensitiveMap<>(changeToMap(changesList));
    CaseInsensitiveMap<String, Object> optionMap = options != null
            ? new CaseInsensitiveMap<>(options.toMap()) : null;

    return new AuditLogEntry(type, id, targetId, guild, user, reason, changeMap, optionMap);
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:35,代码来源:EntityBuilder.java


示例4: finalizeHeaders

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
@Override
protected CaseInsensitiveMap<String, String> finalizeHeaders()
{
    CaseInsensitiveMap<String, String> headers = super.finalizeHeaders();

    if (reason == null || reason.isEmpty())
        return headers;

    if (headers == null)
        headers = new CaseInsensitiveMap<>();

    headers.put("X-Audit-Log-Reason", uriEncode(reason));

    return headers;
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:16,代码来源:AuditableRestAction.java


示例5: Request

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
public Request(RestAction<T> restAction, Consumer<T> onSuccess, Consumer<Throwable> onFailure, boolean shouldQueue, RequestBody body, Object rawBody, Route.CompiledRoute route, CaseInsensitiveMap<String, String> headers)
{
    this.restAction = restAction;
    this.onSuccess = onSuccess;
    this.onFailure = onFailure;
    this.shouldQueue = shouldQueue;
    this.body = body;
    this.rawBody = rawBody;
    this.route = route;
    this.headers = headers;

    this.api = (JDAImpl) restAction.getJDA();
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:14,代码来源:Request.java


示例6: queue

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
/**
 * Submits a Request for execution.
 *
 * <p><b>This method is asynchronous</b>
 *
 * @param  success
 *         The success callback that will be called at a convenient time
 *         for the API. (can be null)
 * @param  failure
 *         The failure callback that will be called if the Request
 *         encounters an exception at its execution point.
 */
public void queue(Consumer<T> success, Consumer<Throwable> failure)
{
    Route.CompiledRoute route = finalizeRoute();
    Checks.notNull(route, "Route");
    RequestBody data = finalizeData();
    CaseInsensitiveMap<String, String> headers = finalizeHeaders();
    if (success == null)
        success = DEFAULT_SUCCESS;
    if (failure == null)
        failure = DEFAULT_FAILURE;
    api.getRequester().request(new Request<>(this, success, failure, true, data, rawData, route, headers));
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:25,代码来源:RestAction.java


示例7: grantedAuthoritiesMapper

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
@Bean
public GrantedAuthoritiesMapper grantedAuthoritiesMapper() {
    final Map<String, String> rolesMap = new CaseInsensitiveMap<>();

    rolesMap.put(FindCommunityRole.USER.value(), FindRole.USER.toString());
    rolesMap.put(FindCommunityRole.ADMIN.value(), FindRole.ADMIN.toString());

    if (enableBi) {
        rolesMap.put(FindCommunityRole.BI.value(), FindRole.BI.toString());
    }

    return new OneToOneOrZeroSimpleAuthorityMapper(Collections.unmodifiableMap(rolesMap));
}
 
开发者ID:hpe-idol,项目名称:find,代码行数:14,代码来源:UserConfiguration.java


示例8: main

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
public static void main(String[] args) {
  Map<String, String> map = new CaseInsensitiveMap<>();

  map.put("ONE", "one");
  map.put("one", "one");

  System.out.println(map.size());
}
 
开发者ID:whyDK37,项目名称:pinenut,代码行数:9,代码来源:CaseInsensitiveMapTest.java


示例9: asMap

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
/**
 * Converts the values to a Java {@link Map}
 * 
 * @param decodeLMBCS true to convert {@link LMBCSString} objects and lists to Java Strings
 * @return data as map
 */
public Map<String,Object> asMap(boolean decodeLMBCS) {
	Map<String,Object> data = new CaseInsensitiveMap<String, Object>();
	int itemCount = getItemsCount();
	for (int i=0; i<itemCount; i++) {
		Object val = getItemValue(i);
		
		if (val instanceof LMBCSString) {
			if (decodeLMBCS) {
				data.put(m_itemNames[i], ((LMBCSString)val).getValue());
			}
			else {
				data.put(m_itemNames[i], val);
			}
		}
		else if (val instanceof List) {
			if (decodeLMBCS) {
				//check for LMBCS strings
				List valAsList = (List) val;
				boolean hasLMBCS = false;
				
				for (int j=0; j<valAsList.size(); j++) {
					if (valAsList.get(j) instanceof LMBCSString) {
						hasLMBCS = true;
						break;
					}
				}
				
				if (hasLMBCS) {
					List<Object> convList = new ArrayList<Object>(valAsList.size());
					for (int j=0; j<valAsList.size(); j++) {
						Object currObj = valAsList.get(j);
						if (currObj instanceof LMBCSString) {
							convList.add(((LMBCSString)currObj).getValue());
						}
						else {
							convList.add(currObj);
						}
					}
					data.put(m_itemNames[i], convList);
				}
				else {
					data.put(m_itemNames[i], val);
				}
			}
			else {
				data.put(m_itemNames[i], val);
			}
		}
		else {
			data.put(m_itemNames[i], val);
		}
	}
	return data;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:61,代码来源:NotesLookupResultBufferDecoder.java


示例10: RestFuture

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
public RestFuture(final RestAction<T> restAction, final boolean shouldQueue, final RequestBody data, final Object rawData, final Route.CompiledRoute route, final CaseInsensitiveMap<String, String> headers)
{
    this.request = new Request<>(restAction, this::complete, this::completeExceptionally, shouldQueue, data, rawData, route, headers);
    ((JDAImpl) restAction.getJDA()).getRequester().request(this.request);
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:6,代码来源:RestFuture.java


示例11: getHeaders

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
public CaseInsensitiveMap<String, String> getHeaders()
{
    return headers;
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:5,代码来源:Request.java


示例12: main

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
public static void main(String[] args)
{
   CaseInsensitiveMap<String, String> map = new CaseInsensitiveMap<>();

   map.put("one", "A");

   System.out.println(map);

   System.out.printf("using oNe as the key to get the value from the map: %s\n", map.get("oNe"));
}
 
开发者ID:developerSid,项目名称:AwesomeJavaLibraryExamples,代码行数:11,代码来源:ExampleCaseInsensitiveMap.java


示例13: submit

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
/**
 * Submits a Request for execution and provides a {@link net.dv8tion.jda.core.requests.RequestFuture RequestFuture}
 * representing its completion task.
 * <br>Cancelling the returned Future will result in the cancellation of the Request!
 *
 * <p>Note: The usage of {@link java.util.concurrent.CompletionStage#toCompletableFuture() CompletionStage.toCompletableFuture()} is not supported.
 *
 * @param  shouldQueue
 *         Whether the Request should automatically handle rate limitations. (default true)
 *
 * @return Never-null {@link net.dv8tion.jda.core.requests.RequestFuture RequestFuture} task representing the completion promise
 */
public RequestFuture<T> submit(boolean shouldQueue)
{
    Route.CompiledRoute route = finalizeRoute();
    Checks.notNull(route, "Route");
    RequestBody data = finalizeData();
    CaseInsensitiveMap<String, String> headers = finalizeHeaders();
    return new RestFuture<>(this, shouldQueue, data, rawData, route, headers);
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:21,代码来源:RestAction.java


示例14: finalizeHeaders

import org.apache.commons.collections4.map.CaseInsensitiveMap; //导入依赖的package包/类
protected CaseInsensitiveMap<String, String> finalizeHeaders() { return null; } 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:2,代码来源:RestAction.java



注:本文中的org.apache.commons.collections4.map.CaseInsensitiveMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExecutorRegistry类代码示例发布时间:2022-05-22
下一篇:
Java MyBatisModule类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap