本文整理汇总了Java中org.apache.commons.collections.map.MultiValueMap.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java MultiValueMap.keySet方法的具体用法?Java MultiValueMap.keySet怎么用?Java MultiValueMap.keySet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections.map.MultiValueMap
的用法示例。
在下文中一共展示了MultiValueMap.keySet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeMultiValueMapFile
import org.apache.commons.collections.map.MultiValueMap; //导入方法依赖的package包/类
public static void writeMultiValueMapFile(MultiValueMap mapping, String path)
{
try
{
FileOutputStream fos = new FileOutputStream(path);
DataOutputStream dos = new DataOutputStream(fos);
Set<Integer> keys = new TreeSet(mapping.keySet());
for(Integer key : keys)
{
Set<Integer> values = new TreeSet(mapping.getCollection(key));
dos.writeInt(key.intValue());
dos.writeInt(values.size());
for(Integer value : values)
dos.writeInt(value.intValue());
}
dos.close();
}
catch (Exception e) { e.printStackTrace(); }
}
示例2: expungeWithoutBackup
import org.apache.commons.collections.map.MultiValueMap; //导入方法依赖的package包/类
/**
* 여러개의 메일을 백업 안남기고 삭제한다.
* @param userId 로그인 이메일
* @param multiMap 메일함 경로와 uid 목록
* @throws javax.mail.MessagingException
* @throws java.io.IOException
* @throws org.apache.james.mailbox.exception.MailboxException
*/
public void expungeWithoutBackup(String userId, MultiValueMap multiMap) throws IOException,
MessagingException, MailboxException {
MailboxSession session = null;
try {
session = loginMailboxByUserId(userId);
mailboxmanager.startProcessingRequest(session);
String userKey = session.getUser().getUserName();
for (Object mailInfo : multiMap.keySet()) {
String mailboxPath = mailInfo.toString();
//기존 메일함
MailboxPath existMailboxPath = new MailboxPath(session.getPersonalSpace(), userKey, mailboxPath);
MessageManager messageManager = mailboxmanager.getMailbox(existMailboxPath, session);
List<MessageRange> ranges = MessageRange.toRanges((List<Long>) multiMap.get(mailboxPath));
expungeWithoutBackup(messageManager, session, ranges); //백업안남기고 완전 삭제
}
} finally {
if (session != null) {
mailboxmanager.endProcessingRequest(session);
try {
mailboxmanager.logout(session, true);
} catch (MailboxException e) {
e.printStackTrace();
}
}
}
}